Why Ruby?

retard re at tard.com.invalid
Sun Dec 19 04:24:54 PST 2010


Sun, 19 Dec 2010 06:08:15 -0500, foobar wrote:

> Walter Bright Wrote:
> 
>> JRM wrote:
>> > you could write:
>> > sort!(@1>@2)(x);
>> [...]
>> > I think this idea (or something similar) is worth consideration.  It
>> > is simply a small extension to an already existing feature that would
>> > give D a terser syntax for lambda's than most of the other languages
>> > we've been discussing.
>> 
>> but:
>> 
>>     sort!("a>b")(x);
>> 
>> is just as short! And it already works.
> 
> I think that the issue here is not about syntax as much as it is about
> semantics: As others said, this is equivalent to dynamic language's
> eval() or to D's string mixin and the this raises the question of
> hygiene which sadly has no good solution in D.
> 
> The main concern is this:
> In what context are the symbols 'a' and 'b' evaluated?
> 
> At the moment they cannot be correctly evaluated at the caller context
> and do not allow: sort!("a.foo() > b.bar()")(whatever);
> 
> The bikesheding of the syntax does not address this concern at all.

Two additional problems were also listed earlier in this thread:

 - template bloat (different strings generate new instances of the sort)
 - symbol visibility problems because of wrong scoping


More information about the Digitalmars-d mailing list