On Thursday, 15 March 2012 at 18:23:57 UTC, Andrei Alexandrescu
wrote:
I understand how the draw of reaching for new syntax is
extremely alluring. I used to fall for it much more often, but
over years I have hardened myself to resist it, and I think
that made me a better language designer. In this stage of D, I
think we should all have an understanding that adding syntax is
not a win. Instead, it is an acknowledgment that the existing
language, for all its might, is unable to express the desired
abstraction. This is sometimes fine (such as in the case of
introducing multiple new symbols from one tuple), but generally
the question is not "why couldn't we add syntax X?" but instead
"why should we add syntax X?"
Andrei
I agree that this is an acknowledgement of the current language's
inability to express the abstraction. That's why many people ask
for it to be added in the first place. We should add this syntax
because it *is* impossible ATM to implement the required
abstraction.
A good design should strive to provide general features instead
of special cases (E.g. swap is limited to the 2-tuple case).
Also, why force an overhead of a function call on such a basic
feature as assignment? Is swap usually inlined by the compiler?