March 29, 2004

Languages with macros

Java
Pebbles - Pebble Beach, California

Nemerle, a language using a syntax similar to C#, has some very interesting support for syntactic macros. It basically allows programmers to extend the syntax of the language with new constructions, not already implemented in the language.

The sample macros they have as examples are for loops and a printf-like function with variable number of arguments. This shows once more why syntactic macros are a good thing to have in a language: there's no need for language developers to implement these features at the language level! The printf as well as other new syntactic-sugars in JDK 1.5 could have been implemented this way.

Last year, during a talk James Gosling gave at Google, I had the opportunity to ask him about macros in Java. His response was along the lines of "we don't need macros, since they are so hard to understand." Needless to say, I was really disappointed by his response.

Interestingly enough, the Nemerle developers seem to have received a grant from Microsoft. Quite interesting, I wonder how long will it take to see C# with macros.

Posted by ovidiu at March 29, 2004 11:06 PM |
 
Copyright © 2002-2016 Ovidiu Predescu.