Language Design 101

Some of our most read threads are our introductions to type systems, monads and continuations, so I guess it wouldn't hurt to start yet another getting started thread.

From time to time we have questions posted about how to start designing a language, or a DSL; I think it would be helpful to collect links to various resources that might help people trying to design their first (or second, or third...) language.

Resources may include design tips, methodological suggestions, detailed discussion of major features (e.g., how important is type inferencing) etc. Think of utter beginners, but also about language mavens with little language design experience.

Two requests: (1) Let's not to turn this into a thread about language implementation tips. We'll do that one later. (2) If we dicussed the papers you recommend in the past, give links to the previous LtU threads.

Links Slides

The speakers at the Links meeting at ETAPS have posted slides from their talks To me, Xavier Leroys slides seem especially interesting, but there is something for everyone. Transactions, XML, Concurrency, Types, Object-Orientation, etc.

Computerworld Development Survey

I don't think this survey is very important, but it wouldn't hurt to take a look.

The top 5 programming languages reported in use were C# (72%), Java (66%), Visual Basic (62%), C++ (54%) and JavaScript (50%).

This study was conducted among subscribers to Computerworld, a total of 966 qualified completed surveys were received.

The selection criteria used to choose among the subscribers of Computerworld (see methodology section at the bottom) are, of course, biased.

MetaKlaim

Gianluigi Ferrari, Eugenio Moggi and Rosario Pugliese

MetaKlaim - a Type Safe Multi-stage Language for Global Computing

This paper describes the design and the semantics of MetaKlaim, an higher order distributed process calculus equipped with staging mechanisms. MetaKlaim integrates MetaML (an extension of SML for multi-stage programming) and Klaim (a Kernel Language for Agents Interaction and Mobility), to permit interleaving of meta-programming activities (like assembly and linking of code fragments), dynamic checking of security policies at administrative boundaries and “traditional” computational activities on a wide area network (like remote communication and code mobility). MetaKlaim exploits a powerful type system (including polymorphic types ´a la system F) to deal with highly parameterized mobile components and to dynamically enforce security policies: types are metadata which are extracted from code at run-time and are used to express trustiness guarantees. The dynamic type checking ensures that the trustiness guarantees of wide are network applications are maintained whenever computations interoperate with potentially untrusted components.

Omega

Ωmega is a new programming language by Tim Sheard which is descended from Haskell and adds new facilities for defining static type constraints, such as allowing "users to write functions at the level of types, and then use those functions in the type of functions at value level". It also has "equality qualified types". See also Programming with Static Invariants in Omega and the manual for more information. Mentioned previously (in passing) on LtU.

Metaphor

Metaphor is a strongly-typed, multi-stage, object-oriented programming language. Metaphor is based on a subset of C# and is extended with multi-stage programming constructs in the style of MetaML or MetaOCaml. Metaphor is implemented as a compiler on the .NET CLR.

Metaphor features a static type system for object-oriented reflection operations (i.e. run-time type analysis). This allows the reflection system to be safely incorporated into the language’s staging constructs and thus allows the generation of code based on the structure of types.

Higher-Order Perl

(via Keith)
Higher-Order Perl is about functional programming techniques in Perl. It's about how to write functions that can modify and manufacture other functions.

Why would you want to do that? Because that way your code is more flexible and more reusable. Instead of writing ten similar functions, you write a general pattern or framework that can generate the functions you want; then you generate just the functions you need according to the pattern. The program doesn't need to know in advance which functions are necessary; it can generate them as needed. Instead of writing the complete program yourself, you get the computer to write it for you.

The book was published on the 8th of March, and the text will likely appear soon on the web site and will remain freely available.

Higher order functions - Lambda for the rest of us

What with all the foolish notions about lambda be passed around since the start of this month, a nice introductory article on Using functions for such higher order purposes as arguments, function-generating functions, and anonymous functions is just what the doctor ordered.

Functions are the wonderful and powerful building blocks of computer programs. Functions allow you to break code down into simpler, more manageable steps. They also allow you to break programs into reusable parts -- parts that are both reusable within the program and in other programs as well. In this article, learn how to create new functions at runtime based on templates, how to create functions that are configurable at runtime using function parameters, and how the Scheme language can be a valuable tool with functions.

Pugs, Practicing the Theories.

A lot of language theory goes past here on Lambda the Ultimate, but we rarely see that theory directly impacting commercial programmers.

I'm a great fan of theoretical concepts like arrows, but at the same time I'm a self-employed programmer interested in solving my clients' problems.

Pugs is notable in that it profitably uses recent developments such as GADTs and Template Haskell for an implementation of Perl6.

I recently became a regular on the #perl6 irc channel and soon after joined the list of committers.

In just a few days I've seen a lot. I've seen enthusiastic members of the Perl community learning Haskell. I've seen myself learning Perl. I've also seen how daily Perl programmers work with abstractions like monad transformers. I've seen how some structures are easy to extend for programmers new to both the Pugs codebase and Haskell.

The Pugs project was started 64 days ago by Autrijus Tang, as an exercise while reading TaPL. Pugs already includes network and threading primitives. New tests and code are add at an amazing rate, as evidenced by the smoke tests.

I don't know if I'll end up using Perl after Pugs is written, but I am learning how to practice the theory of programming language design and implementation.

Jon Udell: Languages and environments

Languages and environments have always been fellow travelers. At some point they'll begin to part ways. Domain-specific languages will continue to flourish; they're the future of programming. But they'll target fewer environments.

It's easier to learn languages than to learn environments. So while these things have tended to proliferate in pairs -- each language carrying around its own environment, like a turtle with its shell -- my argument is that over time the environments will tend to consolidate.

Jon offers a couple of entertaining examples, but the fundamental point is worth thinking about.

Until quite recently the general view was the exact opposite of what Jon is arguing: languages, it was argued, are going to be consolidated. Remember Java as the cure all solution to software?

The proliferation of programming languages, domain specific and otherwise, isn't news for LtU readers. It is a good sign to see it mentioned on Infoworld.