Worst ideas/features in programming languages?

russhy russhy at gmail.com
Mon Oct 11 17:35:27 UTC 2021


On Monday, 11 October 2021 at 16:12:59 UTC, FeepingCreature wrote:
> 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. :)

- features that require a GC (associative array)

- class (reference type)


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


I 100% agree with you


Tagged union SHOULD be built in, telling people to import a 
package and use them like templates is the best way to discourage 
people from getting interested in the language

When other "modern" languages don't have the problem since it's 
built in feature


The positive side of std.sumtype is it showcase the capabilities 
of the language to implement new features on user land, BUT, for 
sumtype, nobody should have to go that road..

Same for Nullable/Optional in my opinion


More information about the Digitalmars-d mailing list