DIP 1002 (TryElseExpression) added to the queue

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 29 07:02:40 PDT 2016


On 09/29/2016 09:00 AM, pineapple wrote:
> One thing I'd point out: You rewrote my rewritten examples without using
> `else`, but as was stated immediately before I listed those examples:
>
>> The best examples of code that can be more elegantly written using this
>> `else` clause occur in application logic, such as the example described
>> above where a values were read from sensors and saved to a server.
>> However,
>> there are a few places in Phobos that could be more readable and not
>> require success flags if this new syntax were employed.

In order to make this kind of argument work, you need evidence. The 
sensor example is weak because (a) it comes with a rich context that is 
only vaguely explained; (b) it is not shown translated in current D; (c) 
it comes from private correspondence - at best it should be from a 
visible project. As of right now, the argument about application code 
being more helped than library code is purely speculative.

That's why I also suggest looking at dub and github, which contain a 
good amount of D application code. You'd make a solid point if you 
showed how a few of those projects can be improved by the use of the 
proposed feature.


Andrei



More information about the Digitalmars-d mailing list