Archetype language

bearophile bearophileHUGS at lycos.com
Sun Mar 20 14:11:55 PDT 2011


Andrej Mitrovic:

> Not so cute (to me). I'd prefer that syntax only in one-liner function
> definitions.

Of course. The example was just to show that with foreach you are allowed to spare the brackets. So in theory the same thing is doable with single-expression functions. And indeed Scala language too does this.


> But a delegate should be a
> single quantity, not a hidden sequence of multiple delegates. That's
> what arrays are for (or even rages).

This is your point of view. I presume Archetype designer (and maybe C# too) don't agree with you.


> Maybe D3 would have these, who knows..

Thinks don't just happen :-) If you want something, you have to work a lot, to grow enough consensus of people that like it, to design it well, find corner cases, and then implement it or find people willing to implment it, etc.


> Do you use tuple return values often, e.g. in Python?

Not in every line of code, but they are quite useful.
Tuples are useful for other purposes too, like:

for a,b in zip((1, 2, 3), "abc"):

Here a,b is a 2-tuple that Python automatically unpack from the result of the zip, that in Python2 is a list (array) of 2-tuples.

So there are some other usages of tuples beside the normal ones. Phobos already has a tuple type. It doesn't have syntax sugar for the unpacking (and maybe better syntax for the tuple literals, but this is less important).

Bye,
bearophile


More information about the Digitalmars-d mailing list