The stately := operator feature proposal

js.mdnq js_adddot+mdng at gmail.com
Thu May 30 13:27:35 PDT 2013


On Thursday, 30 May 2013 at 19:40:54 UTC, Jonathan M Davis wrote:
> On Thursday, May 30, 2013 12:38:09 Timon Gehr wrote:
>> On 05/30/2013 10:50 AM, Jonathan M Davis wrote:
>> > Personally, I don't think think that the extra complication 
>> > caused by
>> > having another syntax for something that we already have is 
>> > worth it,
>> > regardless of whether it's aesthetically pleasing or not.
>> 
>> The complexity argument is not a strong argument for such a 
>> simple
>> feature (It takes around 10 minutes to implement in a compiler 
>> and 2s to
>> learn.), especially given the existing complexity of D.
>
> Except that even if the feature doesn't add a lot of complexity 
> by itself,
> each feature you add to the language adds to the total 
> complexity, and it adds
> up. If we were willing to add new features simply because they 
> didn't add much
> complexity, pretty soon, you'd have quite a bit of complexity. 
> New features
> need to add a real benefit to be worth complicating the 
> language yet further.
> And I don't think that this does by a long shot. auto already 
> provides us with
> this functionality. It's just that the syntax for auto doesn't 
> fit the OP's
> tastes.
>
> - Jonathan M Davis

With that attitude one would never be able to achieve anything 
complex. The goal is not to reduce complexity but to find an 
elegant way to deal with the complexity. If a complex project is 
becoming unmanageable due to the complexity then it is due to the 
project management and not the individual components.

You can't solve complex problems with simple solutions(else they 
would be simple problems). Programming is a complex task and 
requires a more complex, but elegant, solution.

One must ask yourself what ripple effect `:=` would have versus 
what benefit. I see `:=` would provide some obvious reduction of 
visual code complexity while adding very little extra complexity 
to the compiler. The reason being is, at least as originally 
stated, `:=` somewhat a self-contained enhancement affecting 
virtually nothing outside what it specifically does... i.e., 
there are no/little chance for unintended consequences.

I think the issue is that some people think that because they 
won't use it or don't need it that it surely won't benefit anyone 
else(so why go through the extra "complexity" to have a 
feature)... it's a pretty common attitude and somewhat 
egotistical.



More information about the Digitalmars-d mailing list