Hello, folks! Newbie to D, have some questions!

timmyjose via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 20 06:09:14 PST 2017


On Sunday, 19 February 2017 at 15:22:50 UTC, bachmeier wrote:
> On Saturday, 18 February 2017 at 20:15:55 UTC, timmyjose wrote:
>> 4. I have heard good reports of D's metaprogramming 
>> capabilities (ironically enough, primarily from a thread on 
>> the Rust user group), and coming from a Common Lisp (and some 
>> Racket) background, I am deeply interested in this aspect. Are 
>> D macros as powerful as Lisp macros? Are they semantically 
>> similar (for instance, I found Rust's macros are quite similar 
>> to Racket's)?
>
> I was a Scheme/Common Lisp user for quite a while before moving 
> to D. Lisp macros are more powerful (there's not much you can't 
> do with them), but on the other hand, unless you stick with 
> simple use cases, it can be hard to get Lisp macros right. 
> You've got the whole defmacro vs hygienic debate. Also, the 
> rule of thumb is to avoid macros unless you can't do it with a 
> function.

Agreed.

> I was never into heavy metaprogramming with Scheme or Common 
> Lisp. The simplicity of D's compile time capabilities mean I do 
> more metaprogramming in D, and I actually push a lot of stuff 
> from runtime to compile time, which I wouldn't have done with 
> Common Lisp.

That's very encouraging to hear! :-)



More information about the Digitalmars-d-learn mailing list