Why Ruby?

foobar foo at bar.com
Sun Dec 19 09:54:01 PST 2010


Andrei Alexandrescu Wrote:

> > Either way, I personally don't care that much for another syntax for delegates. I personally just want to see this ugly hack removed from the standard library and discouraged. This feature promotes a code smell. And for what, as you said yourself, to save 4 characters?
> 
> "a > b" vs. (a, b) { return a > b; }
> 
> Savings: 17 characters.
> 

I reserve the right to dislike it even if it was 20 characters. The fact that it's a useful hack doesn't make it smell less.

> > D should be consistent with only ONE delegate syntax. This is why Ruby reads like poetry to its followers and c++ is like carving letters in stone.
> 
> Also, Ruby is well slower than C++ and other languages. It's easy to 
> design a beautiful language if that's the primary concern. It's 
> difficult to design a language when you want to keep in harmony a larger 
> list of desiderata.
> 
> > I much prefer that the lowering you mentioned to be implemented so that performance wise this UGLY hack will have no benefits.
> 
> The lowering will unfortunately solve little. I don't see how
> 
> sort!"a > b"(array);
> 
> is horrible but
> 
> sort(a, b; array) { return a > b; }

I wasn't referring to the above which still deals with the syntactic issue. 
I'm talking about making:

sort!"a >b"(whatever);
and
sort(whatever, (a, b) { return a>b; }); 

have the same performance. Thus obviating the need for the first form.
the best form IMO would be of course:

whatever.sort((a, b) { return a>b; });

This touches another topic - the universal function call feature.


More information about the Digitalmars-d mailing list