Worst ideas/features in programming languages?

harakim harakim at gmail.com
Sun Oct 31 02:24:57 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!

It's not a big one, but I find C#'s enumeration type to be almost 
completely pointless in web development because it will 
deserialize invalid values.

If you have
public enum Animal
  Cat = 1,
  Dog = 2,
  Bird = 3

1. You can still load a database row where the Animal value is, 
say, 200, and it will not give you any errors
2. You can still receive a web request for an object with 
property Animal Pet {get;set;} where the Animal value is 1000 and 
it will deserialize from JSON and create the object with a 
non-null Pet property like it did it correctly. When you go to 
use it, it will not be Cat Dog or Bird. It's so dumb.
There is no advantage of using an enum over a type except when 
setting a value manually, which you will not be doing often in 
comparison to user supplied values.

Also, there might as well be methods on C#'s enum, so it's pretty 
much a complete failure.

More information about the Digitalmars-d mailing list