The Expressiveness of D

bearophile bearophileHUGS at lycos.com
Tue Nov 2 10:53:07 PDT 2010


Gary Whatmore:

> This is another one of those low priority issues. Never seen this kind of code in practice. These examples are highly synthetic and come from advocates of "clean" simple languages. "No corner cases" - does it matter if the language is full of broken corner cases if the practical real world code just works?

Yes, of course the number of broken corner cases matters a lot. Few corner cases are acceptable, too many and the language (es. Perl) becomes a mess that I will not use.

-----------------------------

Andrei:

>Orthogonality has been long debated in the PL community. Clearly in reasonable quantities it's a desirable trait, but one must also know where to stop. There are many orthogonal languages that people didn't quite enjoy.<

I agree. Scheme is a very orthogonal language, but I don't like it. You have to build all things by yourself from the offered little (orthogonal) parts.


> My suggestion to address this issue was (and is) to make the assigned
> part of the function call:
> 
> int a, b;
> scatter(tuple(b, a), a, b);
> scatter(tuple(b, a + b), a, b);
> int[] arr = [0, 1, 2, 3, 4];
> int[] c;
> scatter(arr, a, b, c);

I have implemented something similar in dlibs1, but in practice I don't like to use that.
Tuples aren't something you use once in a while, if they are handy and good they become a fundamental language construct, I use them every few lines of code in Python, in every kind of Python programs I write. So they deserve a handy syntax. So it's a situation where some syntax sugar support is warmly encouraged. We may wait for D3, if necessary.

Bye,
bearophile


More information about the Digitalmars-d mailing list