Variadic grouping
bearophile
bearophileHUGS at lycos.com
Mon Jul 29 08:03:23 PDT 2013
John Colvin:
> There are a mind-boggling large number of things that are
> useful, but that's not the criteria for adding something to a
> programming language.
>
> A new feature has to be *sufficiently* useful to justify the
> increased complexity of the language and it's implementations
> (plus not clashing badly with other features). Example use
> cases are a useful way of demonstrating just how useful a
> feature can be.
As example take a look at this commit, a small part of the
changes to port the D front-end to D:
https://github.com/D-Programming-Language/dmd/compare/428e559e5f0b...68ab05dba14a
In this original line 'errors' is a boolean:
errors += global.endGagging(oldGaggedErrors);
It's replaced with:
if (global.endGagging(oldGaggedErrors))
errors = true;
Looking at that code it's easy to think about code like this,
that is not currently supported:
errors ||= global.endGagging(oldGaggedErrors);
Is the "||=" operator useful? Is it working well with the rest of
the language? Is it easy to understand a read? It is not
bug-prone given the existence of the "|=" operator? Even if all
those answers are positive, you have to ask yourself if it's also
sufficiently useful...
Bye,
bearophile
More information about the Digitalmars-d
mailing list