D and the world

eao197 eao197 at intervale.ru
Mon Apr 23 05:43:35 PDT 2007


On Mon, 23 Apr 2007 16:02:33 +0400, Don Clugston <dac at nospam.com.au> wrote:

> Don't bet on it. It's not clear to me that there will be much of use  
> that Nemerle can do, which D will not be able to, once it has macros.

It is not clean to me what kind of macro subsystem D will have. Because of  
that I can't do any prediction.
Big Nemerle lobby exists on the Russian programmer's resource RSDN.ru. And  
people from it sometimes point to interesting example of Nemerle macro  
usages.

For example  
(http://nemerle.org/forum.old/viewtopic.php?p=575&highlight=oyster#575):

   def m1 = Cgs.Mass(1);
   def m2 = Si.Mass(m1);
   WriteLine($"Mass in SI: $m2, in CGS: $m1");

It is sample of string interpolation, when string literal is parsed in  
compile-time and variables marked by $ are type-safely converted into  
string.

And this is an example of "physical literals":

   def x1 = Si.Area(1 cm * 10 m);

where modifiers 'cm' and 'm' implemented via macros.

> The question is, how well does metaprogramming scale in each of these  
> languages?

I don't understand what you meen with 'scale'.
I think there is another threat for Nemerle -- it is so easy to create  
their own mini-language with Nemerle syntax macros -- that would lead to  
incompatible solution for some problem from different programmers.  
Moreover different macro libs may introduce the same keywords into  
language -- that make impossible to use them together. But Nemerle fans  
say that is not a problem :)

> Pages like this one:
> http://nemerle.org/Defining_types_from_inside_macros
> gives me grave doubts about Nemerle. Reading all those macro pages, the  
> whole thing seems like a hack, that exposes many low-level details of  
> the compiler. But obviously, the language may improve with time.

Yes, macro code looks very ugly at the first sight. But this is true only  
when you have no enough knowledge of the language. With time macro code  
could be read without big problems.

The same situation exists even with compile-time code in D :)

-- 
Regards,
Yauheni Akhotnikau



More information about the Digitalmars-d mailing list