Yigal Chripun wrote:
On 09/10/2009 00:38, Christopher Wright wrote:
It makes macros highly compiler-specific, or requires the compiler's AST
to be part of the language.

Nemerle took the nuclear option, and its macros are all-powerful. That's
a reasonable way of doing things. I'd be happy with a more restricted
system that's easier to standardize, especially if it got rid of all the
hacky string manipulation in current D metaprogramming. (Seriously, even
__traits returns string arrays for a lot of stuff. It's ridiculous.)

It doesn't have to be compiler specific. all is needed is a standardized API to the compiler.

Right. It adds something huge that's normally compiler-specific to the language. This makes me uncomfortable. It greatly increases the difficulty of implementation.

What's so hackish about that?

Reread. Current D metaprogramming is hackish. Nemerle's isn't.

many large modular systems do exactly that: eclipse, firefox, even the OS itself. Unix provides syscalls which *are* an API to the OS.

a properly designed API doesn't have to expose internal implementation details.

btw, in Nemerle they have syntax to compose/decompose AST specifically so they don't need to expose the internal structure of the AST.

So they have a separate object model for the syntax tree that macros can affect. This is what I would recommend for D.

Reply via email to