Andrei Alexandrescu:

I don't think "various situations" is a good idea. It often does make code shorter. But it means more rules to be defined, implemented, and taught.

Here I have written "various situations" because I have given a list of those "various situations" in past posts. I think the semantics is sufficiently natural, simple, and it's same for all those cases. I think the main problem in D is syntactic.


It often does make code shorter.

It also avoids the programmer to think about useless details, leaving more brain for more important things. Assigning the fields to variables like this:

const uselessTmp = foo();
immutable something = uselessTmp[0];
immutable secondThing = uselessTmp[1];
const theLast = uselessTmp[2];

is as efficient as leaving that to the compiler.

Bye,
bearophile

Reply via email to