Slashdot Mirror


Designing And Building A New Pragmatic Language

ctrimble writes "A bunch of folks on the pragprog Yahoo! Group have banded together to design and implement a 'pragmatic' programming language. Ostensibly, the language is informed by the principles in Hunt and Thomas's well-received book, The Pragmatic Programmer: From Journeyman to Master but the purpose of the language is to help ease some of the pain of development and bridge the impedance mismatch between the academic aspects of a programming language and the discipline of software engineering. The design is still very much in flux. If you're a programmer, this might be a language you'll be using in a few years (or earlier). This is your chance to get in on the ground floor. What kind of features do you want the language to have? What are your PL pain points? Where could this language do better than existing languages?"

23 of 192 comments (clear)

  1. make the case.... by demian031 · · Score: 4, Insightful

    they should explain why ruby, python, perl, basic, java is bad.

    they should come up with some good improvements for a specific language.

    the world doesn't need an entirely new language. (we already have python).

  2. Already done by keesh · · Score: 5, Insightful
    I believe it's called Ruby. Incidentally, Hunt and Thomas also wrote the Ruby Book, where they say Ruby is pretty much what they had in mind when they wrote Pragmatic Programmer:
    As Pragmatic Programmers we've tried many, many languages in our search for tools to make our lives easier, for tools to help us do our jobs better. Until now, though, we'd always been frustrated by the languages we were using.
    1. Re:Already done by DogIsMyCoprocessor · · Score: 2, Insightful
      Ruby gives a strange impression. It combines some of Perl's choices (magic variables, regular expressions as part of the syntax rather than as a library, and variable prefixes that look like line noise) with stealing some nice stuff from Smalltalk, and oddly, using end as a block delimiter. It comes across as baroque, not beautiful.

      A pragmatic language should have mature class libraries. (That's pragmatic, isn't it?) Ruby doesn't.

      --

      "And this is my boy, Sherman. Speak, Sherman." "Hello." "Good boy."

    2. Re:Already done by kwerle · · Score: 2, Insightful

      Sign up another disagree. I don't want to have to write a stack, queue, or quicksort - I did that in college. I don't want to write another http socket client, I did that at the end of last decade.

      Moving libraries into the language is like moving web servers, web browsers, office suites and solitaire games into the kernel. Some people will think it's cool, but others will wonder why they can no longer fit a bootdisk onto a 1.44Mb floppy.

      People who want 1.44Mb boot floppies should:
      1. Buy a real computer - one without a damn floppy.
      2. Invest in some kind of IO that supports CD booting.
      3. Write their damn kernel in C - that's all the language is good for (IMO)

  3. ... and for God's sake get it right this time! by crmartin · · Score: 4, Insightful

    First thing: read Tony Hoare's critique of Ada. (CAR Hoare, Hints on Programming Language Design, 1978). All the current common languages are way too complex.

    Second, make sure the language has a formal semantics from the start. This semantics needs to include concurrency and how it works. I can think of half a dozen languages (Ada, C++, Java, ...) in the last 20 years that decided this was just too hard, and eventually paid for it.

    Third, make sure that the notation either explicitly uses files, or is completely independent of files. Probably the most annoying aspect of Java is that the package structure implicitly depends on a directory hierarchy (but some OS's don't have hierarchic file systemss) but doesn't deal with package structure in anything like the way hierarchic file systems do (what does 'import java.*.event' mean?)

    Fourth, write a lot of sample programs, and test each with experienced programmers, saying 'what does this program do?' If the programmer doesn't get it approximately right, rethink the syntax.

    1. Re:... and for God's sake get it right this time! by AtrN · · Score: 2, Insightful
      Occam did reasonably well at CSP things (Rob Pike's newsqueak did it better however) but fails at almost everything else.

      I recall Inmos stating "We want to make occam the FORTRAN of parallel processing." My reply was "You have." (ref. to lack of data structuring other than fixed sized arrays).

      It wasn't until the hacked up occam 2.5 that it got some better programming language features.

    2. Re: ... and for God's sake get it right this time! by crmartin · · Score: 2, Insightful

      I thought it was in his 1981 speech, ....

      The cite could be wrong -- I was scrounging quickly on the net. In fact, thinking about it, it's almost certainly wrong, because the paper came out when I was in grad school, and I started in '83.

      Concurrency as in multitasking/multithreading? It's really easy in Ada, and it works quite well everywhere I've used it.

      The problem isn't that it works badly, necessarily -- it's that it doesn't work the same way everywhere. At least as of Ada 83, the semantics of a task were't the same from machine to machine. Made it a real bear to reason about the behavior of an Ada program.

    3. Re:... and for God's sake get it right this time! by crmartin · · Score: 2, Insightful

      You're missing the point in a couple of ways.

      First, unfortunately, the package name does not represent just a name space to the compiler. javac as distributed by Sun, and every other implementation of Java I'm aware of (with the exception of the late lamented Visual Age for Java), requires the package naming structure to correspond 1-1 with a path tree structure.

      You're misunderstanding the namespace notion a bit though: If I import java.util.Date, I'm not adding a namespace, I'm adding a name to my current namespace or scope. import java.util.* might be thought of as importing a name space, or at least adding a collection of fully qualified names to the current name space. But if we see a wildcarded import that way, why shouldn't import java.*.Date bring both names into the name space? (Answer: because they'd still have to be referred to by fully-qualified names. But then, since there is no difference, why make it a syntax error?)

      The point here is that Java purports to construct a hierarchically-organized namespace, but doesn't actually do so. (Thought experiment: what's the effective difference between import com.foo.bar.* and import com-foo-bar.*? Ans: none except that you don't have to have a directory tree four deep for your sources.)

      Oh, and as far as your ls point: don't try to teach Grandma to suck eggs, son.

    4. Re:... and for God's sake get it right this time! by crmartin · · Score: 2, Insightful

      As a database fan, I say farm concurrency off to the database...

      But, as someone or other undoubtedly said, quis custodiet ipsos databases? Someone has to write the damned things.

      (Plus, there are a lot of things other than databases which need concurrency control, eg, an operating system kernel.)

  4. Give me every feature and make it fast. by Pyromage · · Score: 2, Insightful

    Every language feature has use. Pointers, references, pointers to pointers, pointers to functions, reflection, OO, templates, multiple inheritance, interfaces, enforced contracts, garbage collection, manual resource management, virtual machine, native execution.

    All these features have uses. There is always 5 cases for every single one where it's *much* easier to implement while using it.

    Now abandon backwards compatibility and think up reasonable syntax. I don't know if it's possible to do an elegant language with all that, but if it is, I think we should have one. Every other language lacks some of the above features. I would like to see a langauge that really had everything.

  5. i've leart one thing ... by sir_cello · · Score: 2, Insightful


    that there is no "one language", there are multiple languages for multiple purposes, and the boundaries between languages are often blurred (just like everything else in life).

    in addition to making your case (as stated by other poster), also
    - what particular context/problem are you trying to solve;
    - what are the specific characteristics and issues in that context/problem;
    - how does your new language provide a better solution than other solutions;
    - how does your new language stand up on theoretical issues (looking at the science of design of languages themselves)

    if there's an existing well used language that is "close" to what you want, and such language has quite a following/momentum, then can you try to adapt/evolve it rather than creating a dud language that goes nowhere (a waste of time for everyone). do you really need a new language, or do you need to help educate on the use of an existing language (i.e. are you more about process than product).

  6. So long as it compiles in to object code. by AxelTorvalds · · Score: 2, Insightful
    I was just marvelling at the new Mandrake compiler RPMs and how they now have C, C++, Objective-C, Ada(95), Fortran, Java and Pascal all supported in there. Very cool. I don't know why, I haven't coded a line of Pascal in over 10 years but it just feels right having a pascal compiler sitting around. There are some programs that are amazingly easy to read and write in pascal... I never seemed to have stack or buffer overflows in pascal..

    I've thought about this a bunch over the last few years. IBM has the PL series of languages. PL/S and PL/X were deamed "strategic" and as such they were never standardized outside IBM, yet IBM continued and still continues to use them for different tasks. There are reams of code written in them and REXX, another IBMism. Lucent has a dozen languages for their own use. Modula-3 started as a DEC thing before is was kind of opened to the world (damn beautiful language I might add, if only more people used it and DECpaq-Hewlet relicensed the gcc front-end code so we could integrate it..) MS has their BASICs and now C#. And numerous other companies have found it either advantageous or some engineer got it in his head that it was a good idea for them to produce their own custom langauge and that they could produce apps in it faster than by using off the shelf components. To some degree I think it's true, you'd be surprised at some of the REXX that holds the world together. I've kind of thought that it was time for an OpenSource language of sorts, there is perl, python, ruby and others but something that can be compiled in to real high performance object code and something that helps us solve the problems we run in to.

    I'll tell you what I think would be killer, in my rambling sort of way. Syntax is key just because people are picky about it, something java like would be great. Make it a front-end to gcc, this gives it a sense of credibility and support and a great optimizer and platform support. Build it so it can easily link with C code. Give it bounds checking and type checking. I thinking it will be very C like for the most part; have that light weight feel to it where you can see the opcodes that the compiler is going to produce as you write in it. Give it objects and classes, but make it light weight on the syntax, building new classes in java requires a new file, doing it in C++ can be feel like lifting the titanic some times because it's proper to add headers as well as implementations. Then with the standard class library, it needs some fundamental object classes like strings (I can't believe how long it was for a standard C++ string class to exist, i've use about a dozen different ones prior...) and sockets (make OpenSSL as close to a boolean flag as you reasonably can...) probably some others I'm not thinking of at the moment. Keep them lean and mean like they are in C but beef up the areas of weekness. Some sort of regular expression engine should be available also.

    For example, strcpy shouldn't exist or there should be some kind of type checking to verify that the inputs are indeed strings and it allocates memory. memcpy is missing several arguments, notably the source and destination sizes. I can probably list dozens of C and C++ problems are aren't language issues so much as library issues that have realworld impact and cause real problems. Now the first class objects that are passed in to strcpy or memcpy (whatever they get called in this new language) could have the missing pieces of information or the API can be built to support it. Basically, I'm suggesting that we add the few instructions it takes to do bounds checking, it's simple code to add to a c compiler. Let's get rid of buffer overflows as much as we reasonably can with the under lying language. Now if you want to do tricky shit with pointers then so be it but if you use standard language constructs (functions will have in and in-out parameters like the C++ & qualifier.) then you should be pretty safe from buffer overflows. With good type checking and such w

  7. Re:Wish List by smishra · · Score: 2, Insightful

    You are talking about OCaml. To your list I would like to add large set of high level standard libraries This is the only prerequisite that prevents me from using Ocaml in most of my work. R

  8. My PL pains by Tom7 · · Score: 3, Insightful

    The worst missing features in most programming languages that I sometimes have to use:

    - lack of sum types. Languages have long offered conjunctions (structs in C, tuples in python). Disjunctions are equally useful. (With it, a function could return one of two possible types. The overuse of 'null' as "the other pointer" in C/C++/Java accounts for a tiny corner of the possibilities here.)

    - lack of higher-order, nested functions. You can do so so much with functions once they are first-class in your language. All this stuff about iterators over containers in Java and "I want SQL built into my language so I can say for each employee in query do" is subsumed by map/fold operations and higher order functions, for starters.

    - lack of safety. Man, I sure hate tracking down memory corruption bugs, and I sure hate it when there's an exploitable security hole in my or someone else's code because of them.

    I already have languages with these features and more, so I don't need recommendations. But if your new sparkling language doesn't have these features... then what are you doing?!?

    1. Re:My PL pains by Tom7 · · Score: 2, Insightful

      Indeed. With sum types you can get rid of the dreaded null pointer -- you have "real" pointer types, and then you have "optional" types like you mention with Found/NotFound. Now, not only does it force a check before using the potentially "null" pointer, but once you check it you know it really points to some object and you don't ever need to check again. It's painfully obvious once you've programmed like that, but somehow people continue to miss out on this feature because, I guess, it was never in C.

      Taking it a step further, recursive sum types like in SML can be used to define recursive data types like lists and trees, and then pattern match against them. That's so nice compared to the way you'd do it in Java or C++.

  9. Could be hard... by DarkDust · · Score: 3, Insightful

    It's sad, but I believe this will fail horribly. The past has shown that "committee" languages don't succeed (or at least only in some niches, like Ada).

    In my experience systems (like PL, applications or even OS's) are best when designed by just a small group of people: not too few and too many (I guess four to six people is a good value). Too few (just one or two) tends to include just the exclusive view of thing from the designer, while too many just makes a great mess since it's hard for a group of people to settle on one point.

    Another thing I learned while reading some of the stuff about C and its history on dmr's homepage is that languages which are defined first and implemented later often hold some promises in the form of "in theory this should be very elegant and nice, but it turns out to be annoying or very, very hard to implement".

    dmr also said one of the reasons C succeeded was because it was created to fit a need, not to make a point or as demonstration. So if there is need for some features then this project might succeed, but I don't see any striking needs any more, there is already a PL for almost every problem out there (and interestingly nearly every PL out there is very strong/elegant in solving certain problems but fails horribly in others).

    But nonetheless I wish the people participating in this project all the best, if they would come up with an interesting, useful and beautiful language that would make an improvement to the PL world this would be a very cool thing :-)

  10. Re:what is a pragmatic language? by turgid · · Score: 4, Insightful
    with little attention paid to consistency and orthogonality

    No, that just makes is clumsy, quirky, difficult to read and difficult to write.

    A "pragmatic" language would be one with little or no "red tape", with sensible defaults, clean syntax, easily optimised, portable, easily extended, consistent, orthogonal and easy to learn. It should be difficult to "shoot yourself in the foot."

    In my mind, PERL has its place : scripting. Serious application development should be done is somehting more "pragmatic".

  11. Re:The 100 year language by zero_offset · · Score: 4, Insightful
    VBA is being used currently for a lot of that work - but it is truly horrible.

    VBA is isn't horrible. It's the MS Office object models that are pure cluster fucks.

    However, what's truly horrible is the code that those same self-taught average office works write. I didn't get the impression that was their target, but if it was, they'd have their work cut out for them.

    In my experience, the average office worker's explorations of VBA always follow the same path... they discover it and play with it... they build something useful with it... the useful thing is shared with other workers... it becomes a critical business tool... it fails miserably (possibly causing lots of confusion and/or costing a lot of money)... then it's thrown over the fence to IT for an emergency-fix... What does it do? "We don't know, we just have to run it every morning. It was written by that guy who quit last year. It worked until yesterday."

    If these pragmatic-language guys ever decide to tackle the non-professional-programmer experience, they REALLY have their work cut out for them -- and not even the best language in the world can solve the problem of a really badly-designed object model.

    --

    Slashdot quality declines as the number of hot grits posts decreases. - Provolt's Law, Apr-09-2005

  12. Common Lisp? by Anonymous Coward · · Score: 1, Insightful

    Argh. Stop it already, Common Lisp already exists!

  13. The role of libraries by Anonymous+Brave+Guy · · Score: 4, Insightful

    I think I understand where you're coming from, and I agree with the principle, although I don't entirely agree with exactly what you've said.

    I think the issue of how libraries are handled is crucial to the success of a modern programming language, as numerous success stories and famous failures can testify. Here are a few random thoughts; how do they match up with yours?

    Firstly, I agree that it is best to keep a small "kernel" standard library. This library should be very well designed, with as much thought put into it as the language itself. In particular, it must be readily extensible by other libraries without being overcomplicated. If you like, it should provide a framework for doing common programming tasks, without filling in too many specific cases.

    However, I don't think it's either easy or desirable to separate libraries completely from the language itself (as in syntax, grammar, etc). Your own comment about C++ is wrong, for example: you cannot ignore the standard library completely, because certain language operations (such as a failed dynamic_cast on a reference type) result in behaviour that needs library support (throwing an exception of a type defined by the standard library).

    Now, you could get around that by creating new standard types for such cases, but do they really belong in the formal grammar of the language, alongside normal exception behaviour but distinct from it? The point is, from a programmer's perspective, it doesn't matter whether that exception type is in the library or the language. It should function identically, offer the same interface, exhibit the same behaviour, either way. It shouldn't matter whether my string type is part of the language or part of the library; it should just work.

    The same goes, to a lesser degree, for other libraries. Once I've decided to use a library (or part of it), that extra functionality should just be there. I shouldn't have to care where it came from, and the only time I should have to know it's in a library is when I'm identifying the functionality I want to use. The syntax, style and function should be just like any other feature of the pure language and its standard library.

    As a final point, while I believe the standard and portable library should be compact and highly flexible, it's obvious that having a widely recognised and comprehensive library of commonly used functionality is advantageous. Look at the success of Java, for example; although many of its standard libraries suck compared to alternatives for other languages, or even replacements available for Java, that doesn't matter to many Java programmers, because they're good enough. OTOH, this results in suboptimal code due to laziness and/or lack of knowledge of alternatives on the part of many Java developers.

    The solution to this, IMHO, is to follow the path set by Perl (CPAN), TeX (CTAN), etc. The sponsors of the language -- commercial or community -- should provide a well-known and recognised central repository, into which contributers can add their own offerings. Better yet, adopt a genuine community review process, such as the C++ Boost community has, to force higher standards within the libraries in the repository.

    So, in my ideal little world, a language would have a structure such that libraries and language were indistinguishable except where identification is concerned (basically just a matter of how to specify which libraries are desired, and naming conventions to prevent clashes between them). The language should come with a standard library that provides really common features (basic math functions and string handling, for example) in flexible frameworks on which other libraries can build. The bulk of library functionality shouldn't be standard -- that's too invasive and too limiting -- but ideally should be collected in a central repository of peer-reviewed offerings, with simple, standard and widely known conventions for using those libraries in programs. This way, no-one uses substandard code by default, but you still have the comprehensive functionality base there when you want it.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  14. Re:Haskell or Lisp by Anonymous Coward · · Score: 1, Insightful

    And I think the / should go \ in the unix filesystem. It improves readability IMO and better fits with what people are used to.

    Seriously though, it takes about 5 minutes to get used to the lisp syntax, and once you do, you realise it's that way because it means the syntax for function calls is the same as the syntax for everything else. Lisp syntax is truly trivial, and I love the way you never need to worry about it beyond maybe counting parens if you're in a sucky editor (top tip: just keep a running tally) It means you can just write your code, without having to figure out where the fuck a stupid ; is supposed to go, or whether the precedence order means that you need to put more parens in you expression, because everything in lisp is an expression with the same syntax. Syntax just gets in the way of coding, in my experience.

  15. Make it TYPEable by mhotas · · Score: 2, Insightful

    Of course READability is important; but what about writability (and in particular, typeability)? Specifically, anything which avoids the use of the Shift key or multi key combos. Maybe what I really want is a programmer's keyboard which allows underscores, parens and major operators to be available without an awkward vulcan nerve pinch.

    1. Re:Make it TYPEable by Anonymous+Brave+Guy · · Score: 2, Insightful

      Ultimately, while being easy to write does confer a small advantage, being easy to read is much more significant. As the oft-quoted motto reminds us, code is only written once, whereas it's likely to be read many times. A vanishingly small amount of a developer's time is spent typing. Most is spent in design, testing, documenting and such rather than programming, and even of what I'd call programming, only a tiny fraction of the time is spent pressing keys on a keyboard.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.