Unofficial wish list status.(Jul 2008)

Yigal Chripun yigal100 at gmail.com
Wed Jul 23 22:54:08 PDT 2008


Walter Bright wrote:
> Yigal Chripun wrote:
>> Walter, please take a look at the design used by Nemerle.
>> The language designers of Nemerle achieved a _very_ pluggable
>> architecture via Macros (probably identical to your idea of AST macros).
>> their system allows to implement whole subsets of the language
>> *including the syntax* as plugins which in D are now part of the
>> language. They have DBC, concurrency, etc implemented like that. they
>> have a plan to make an AOP plugin as well.
>> look at:
>> http://nemerle.org/Macros
>> http://nemerle.org/Syntax_extensions
>> http://nemerle.org/doc/Nemerle.Compiler.html
>> etc..
> 
> I've heard about nemerle now and then, but have never looked at it. One
> of the problems with a user definable syntax is the code may become
> unreadable. I still find it hard to see how one could implement a const
> type system, for example, as a language extension. It's a lot more than
> just syntax.

IMHO, syntax extensions with a few restrictions on what syntax can be
added to the language is very powerful. but even without the syntax
sugar, those macros of nemerle are very powerful and a lot more
expressive than templates. the main gripe I have with templates is that
they require a different syntax. in nemerle you just use the same code
you write at run time to create compile time constructs/ plugins to the
language. you do not need to copy OOP features such as interfaces into
compile time "concepts" as C++0x does.

It's possible to implement D const in nemerle beacuse they provide
Compiler APIs that let the programmer plug their macros at different
stages of compilation. This is the important thing here, more than the
syntax. You have a way to talk with the compiler from your code. This is
why DBC is implemented as a set of macros with syntax extensions and
allows to implement AOP in the same way.

The GC in D has an API that allows your code to control GC via APIs. In
the same way, Compiler APIs allow you in compile-time code to control
and alter the compilation process.




More information about the Digitalmars-d mailing list