On Wednesday, 23 January 2013 at 07:57:10 UTC, Andrei Alexandrescu wrote:
Martin Odersky confessed to me being quite worried about the possible community reaction to the introduction of AST macros. I haven't kept close tabs to see how it's turning out.


Can he or you explain why ?

I completely disagree. (Sorry to foul you twice.) All AST macro systems I've studied are considerably difficult to understand and use effectively. By comparison, string macros are brutal and unstructured but the kind of thing all programmer worth their salt can get done.


2 things here.

First, that is why people used to say about templates. D shows that this isn't a fatality.

Secondly, this is true that AST macro is probably harder to understand. In fact, it is not expected that most programmer use it (or at least not before I'm retired as a dev). I don't even think any experienced dev should use it on a daily basis.

However, it opens so much doors. First, no need for a custom compiler to test new features. Anyone can download source code and start using some new features. We can actually integrate field tested stuff in the language. Every D compiler can get the new feature as well.

If a feature is controversial, I can include in in my project, but not in D in general.

An example of such new feature is the iteration mechanism proposed here.

However, I do think that attribute was a key piece for such mechanism, and has been handled the most backward possible way. So clean AST macro may have been impaired here.

Anyway, I do strongly feel like we should stop adding more stuff now. Too much stuff is here already, some already start to misbehave together. It is probably time to consolidate the language, and keep that kind of stuff for a later version.

After all, many language live without most of the feature D have.

Reply via email to