Worst ideas/features in programming languages?

FeepingCreature feepingcreature at gmail.com
Mon Oct 11 16:12:59 UTC 2021

On Monday, 11 October 2021 at 15:59:10 UTC, Atila Neves wrote:
> I'm brainstorming about what I'll talk about at DConf, and 
> during a conversation with Walter I thought it might be cool to 
> talk about:
> * Worst features implemented in a non-toy language
> * Worst features (in your opinion) in D
> * Features you'd like to see in D
> Ideas? Examples?
> Thanks!

Objectively worst feature: mutability/referenceability by 
default. It takes away *so* much optimization potential and 
introduces so many opportunities for state changes. `var = value` 
should be opt-in. Just as importantly, `&var` should be opt-in.

My D hobbyhorse, of course, is `__traits(compiles)` (see my last 
DConf talk) and the SFINAE-like mess that it enables but doesn't 
give us the tools to address. "Why did the template not 
instantiate?" Who knows~ That syntax error got suppressed five 
instantiations down.

And there's obvious stuff like the half-baked `immutable` that 
works in about half the stdlib and a smaller fraction of 
libraries. D2 const was a mistake, cmv. (Nonreferenceability 
allows safe reassignment of immutable struct member fields, btw!)

But I'm actually convinced that the worst thing is the lack of 
implicit construction for sumtypes. Because when you try to 
actually use sumtypes, you end up with stuff like 
`Nullable!MySumType(MySumType(MemberType("Hello World")))`. *All 
over the place.* And it adds no value! The whole point of 
`MySumType` is that it's "one of n types, including 
`MemberType`". Writing out the full type of a nested container 
type like that adds nothing of value.

Sumtypes should be built-in, and they should implicitly construct 
from its member types.

PS: But staring at this post interface, what I want the most 
*right now* - a "Discard all drafts" button. :)

More information about the Digitalmars-d mailing list