Template Metaprogramming Made Easy (Huh?)

bearophile bearophileHUGS at lycos.com
Fri Sep 11 03:14:22 PDT 2009


Justin Johansson:

>I'm somewhat reluctant to discuss Scala too much here as this is a D forum,<

Discussing other languages is allowed here, especially if they show good things or bad things that may help D development.


> 2. Scala cannot make up her mind if she's a scripting language or serious language.<

Scala purpose is to try to be good for both small and large programs, that's the meaning of Scala, that stands for "Scalable language". I'd like to see D2 become a little fitter for small programs.


>Optional semicolons at the end of statements are really frustrating for code style consistency.<

Semicolons are noise, they slow down programming a little. Better to design future languages where newlines are enough. See also the Delight language, that's better than normal D.

 
> Read Cedric's blog June 2008 for example
> http://beust.com/weblog/archives/000490.html

The comments to that blog post are more intelligent and useful than the main post. See for example the comment by Amit Patel.


>http://www.unlimitednovelty.com/2009/04/why-i-dont-like-scala.html<
>Furthermore, Scala's object model is not only familiar, it's extremely well-studied and well-optimized. The JVM provides immense capability to inline method calls, which means calls which span multiple objects can be condensed down to a single function call. This is because the Smalltalk-inspired illusion that these objects are receiving and sending messages is completely suspended, and objects are treated in C++-style as mere chunks of state, thus an inlined method call can act on many of them at once as if they were simple chunks of state. In Reia, all objects are concurrent, share no state, and can only communicate with messages. Inlining calls across objects is thoroughly impossible since sending messages in Reia is not some theoretical construct, it's what really happens and cannot simply be abstracted away into a function call which mutates the state of multiple objects.<

D compilers are generally not even able to inline most virtual calls, so Reia doesn't look like a fitting design for a language that must be fast as D. Reia design looks good for a higher level language. Scala is designed to be faster than Reia. Maybe someday people will find ways to efficiently compile Reia too, similar things have appened several times.


>http://clojure.org/<

Clojure is not OOP, and it lacks several of the modern functional features (like a powerful type system). And it's slow. I don't like it a lot, despite its management of immutability is cute.
Something about this topic:
http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/
http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/

Bye,
bearophile



More information about the Digitalmars-d mailing list