DIP 1002 (TryElseExpression) added to the queue

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


On 09/28/2016 04:21 PM, pineapple wrote:
> On Wednesday, 28 September 2016 at 20:18:06 UTC, pineapple wrote:
>> This is not and was not intended to be a glorious, incredible addition
>> to the language. It is meant to shove D a couple inches further in the
>> direction of modern programming constructs. Everywhere a programmer
>> can use `else` instead of mucking about with a boolean success flag
>> and having to make absolutely sure the code intended to handle a
>> success state doesn't and will never be modified to throw an exception
>> that the error handling code isn't designed for means less time spent
>> on tedium, and less opportunity for programmer error.
>
> Or, more concisely:
>
> Just because we have `for` doesn't mean we reject `foreach`.
>
> Just because we have `while` doesn't mean we reject `for`.
>
> Just because we have `goto` doesn't mean we reject `while`.

A DIP should stay as far away from this kind of argument as possible. 
Redundancy of existing features should not be used as precedent and 
justification for adding another redundant feature.

The right angle here is to successfully present evidence that the 
frequency of a specific idiom/pattern is high enough to justify adding 
redundancy.

+cc Dicebot to add this to the guidelines


Thanks,

Andrei



More information about the Digitalmars-d mailing list