Worst ideas/features in programming languages?

Paul Backus snarwin at gmail.com
Tue Oct 12 18:12:14 UTC 2021

On Tuesday, 12 October 2021 at 17:49:10 UTC, Steven Schveighoffer 
> 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:
> ```d
> 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 extraneous.

This syntax is cute, but it's also extremely opaque, and 
confusing to beginners [1][2]. `(){}` is not much better, but it 
at least makes it clear that what you're looking at *isn't* a 
normal block statement, and you need to check the 
documentation/ask in the Learn forum/etc. to find out what it is.

[2] https://forum.dlang.org/post/i40s2i$271n$1@digitalmars.com

More information about the Digitalmars-d mailing list