Worst ideas/features in programming languages?

Steven Schveighoffer schveiguy at gmail.com
Tue Oct 12 17:49:10 UTC 2021

On 10/12/21 12:22 PM, Paul Backus wrote:
> On Tuesday, 12 October 2021 at 13:26:34 UTC, Steven Schveighoffer wrote:
>> On 10/12/21 8:42 AM, bauss wrote:
>>> Yeah, but I would rather that it was still allowed and that the 
>>> semantics just changed.
>>> But obviously for good reason that isn't happening since it would 
>>> break existing code.
>> What would you change it to?
> IMO the actual answer here is to deprecate the `{ /* ... */ }` syntax 
> for function literals entirely.
> Not only is it confusing in the context of `=>` lambdas, it also creates 
> a grammatical ambiguity between function literals and [block 
> statements][1], which results in bugs like [issue 21619][2].
> [1]: https://dlang.org/spec/grammar.html#BlockStatement
> [2]: https://issues.dlang.org/show_bug.cgi?id=21619

It's not a terrible idea. But I think there are hacks all over the place 
that enjoy the short syntax. One that I know of is to get the parent 
scope of a location:

alias parentScope = __traits(parent, {});

Now, changing this to `__traits(parent, (){})` probably isn't a horrible 
update to require, but this code breakage is going to seem a little 


More information about the Digitalmars-d mailing list