How about macro == symbol for mixin statement? [was Re: Member functions C to D]

Bill Baxter wbaxter at
Wed Oct 7 11:05:35 PDT 2009

> On Wed, Oct 7, 2009 at 11:21 AM, Don <nospam at> wrote:

>> By contrast, something like Nemerle macros are a kludge. The idea of
>> providing a 'hook' into the compiler is a horrible hack. It exposes all
>> kinds of compiler internals. Yes, it has nicer syntax.

Are you talking specifically about the ability to define new syntax?
Because it looks to me that one can use nemerle macros just fine
without defining new syntax.
I'm getting that from here:

Here's just a simple macro that adds no new syntax from that page:

macro m () {
  Nemerle.IO.printf ("compile-time\n");
  <[ Nemerle.IO.printf ("run-time\n") ]>;

module M {
  public Main () : void {
    m ();

That seems significantly more elegant to me than

string m() {
   pragma(msg, "compile-time");
   return q{writefln("run-time");}
void main() {

So it looks to me like the mechanics of it are basically identical.
Just Nemerle's syntax is nicer.

If you want to condem Nemerle's ability to define new syntax, I think
that should be taken up as a separate matter.


More information about the Digitalmars-d-learn mailing list