Pushing D's mixin to the limits: Project Euler Problem 61 from Ruby to D by David Oftedal

Rounin via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jun 12 13:35:37 PDT 2014


Hey there!

Yeah, to expect people to register on LiveJournal in this age of 
Facebook... Sorry about that; It must have been to deter the 
spammers.

Thanks for taking the time to comment! Your solution with the 
single call to mixin() is much more elegant. I made a version 2 
which uses it.

The reason I used a double mixin() was that the first thing I 
tried was mixin("foreach() etc. etc."), which I think may have 
failed due to the foreach, then mixin("defineMain();"); , which 
was interpreted as a function declaration, and then I went 
straight for the mixin("mixin()"); . If it ain't broke, et cetera.

I still think the double mixin() can compete in terms of comedy 
value, though, don't you think?

Also, thanks for pointing out UFCS. It seems like a very 
convenient, not to mention SANE alternative to monkey patching, 
and it'll make it even more seamless to port code that makes use 
of that mechanism.


More information about the Digitalmars-d-announce mailing list