Why Ruby?
JRM
a at b.com
Sat Dec 18 18:08:10 PST 2010
On Sun, 19 Dec 2010 02:35:16 +0100, Andrej Mitrovic wrote:
> imo, those @'s (or monkeys, as we like to call them) are a sore pain in
> the eye. And what if you need to do some simple arithmetic with the
> numbered arguments?
>
> someFunc!(@1+1>@2)(x);
>
> Might be a silly example, but code like this could exist and will be
> confusing.
>
I agree that all the @'s aren't too easy to read. I might prefer _1, _2,
etc.
I think someFunc!(_1 + 1 > _2)(x); is a little bit easier on the eyes.
But in general, the purpose of a short lambda syntax is to make it easier
to read and write simple expressions. If the expression becomes complex
enough that they become too difficult to read, there is always the option
of writing the full delegate syntax.
No matter what, I think some sort of placeholder syntax to shorten the
common lambda's (whether it be @1, _1, _a, or something else) would be
helpful.
More information about the Digitalmars-d
mailing list