[OT] Sharp Regrets: Top 10 Worst C# Features

Chris via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 21 03:59:36 PDT 2015


On Thursday, 20 August 2015 at 21:16:40 UTC, Walter Bright wrote:
> On 8/19/2015 3:09 AM, Chris wrote:
>> #3 Here we go again... I wonder what's the problem with this. 
>> I still think it's
>> a very handy shorthand for cumbersome `x = x + 1` or even `x 
>> += 1`. And no, it's
>> not confusing, because it is well defined as incrementing the 
>> value by 1. In
>> fact, I don't like Python's patronizing insistence in having 
>> to write `x = x + 1`.
>
> x=x+1 has further problems if x has side effects.

The only time I had problems with `x++` was when I was trying to 
be smart and have it in a debug statement like `writefln("count = 
%d", cnt++);` or when accessing an array like `auto value = 
myArray[cnt++];`, which is clearly not the language's fault, it's 
rather my trying to be a super cool coding cowboy. 'Yeah Ma'am, 
that's how we do it in the Wild West!'.

The whole article, imo, is like saying that when dealing with 
programming there are problems, difficulties and outright 
contradictions (like in maths or any other logical system the 
human mind has come up with), but language designers should make 
all these evil things go away! Imagine you had to attach warnings 
to a programming language, like the labels on microwaves "Don't 
put your pets in it [you stupid *****]!".

Warning:
`++` may increment a value by one!


More information about the Digitalmars-d mailing list