I previously had a list of things I wanted. Yes, I am like a 2-year old. I want. I want. I want.
- List Literals – it is silly that I even have to request this
- Dictionary Literals – see list literals for comments
- Extensible Literals – the .NET BCL already has this really great type conversion system. You ask for a type converter for a specific type and whether or not it can be converted between two types. One of these types is often a string. You can write your own converters and register them with this system of type converters. It is very elegant and beautiful. The compiler should use this to let me express my own literals. Type initializers are nice, but this would be nicer.
- Variable Generic Type Parameter Arity – Chris Marinos had a use case for this and had to implement a solution in a much less elegant way because he was missing this feature. Its a request in Java too. Cliff Biffle says that Mongoose has them, but I can’t find whatever became of the smalltalk inspired language.
- Restricted Types – The same post on Variable Generic Type Parameter Arity, Cliff reminded me of my favorite Modula-3 feature. He points out that Dylan has it. I like Modula-3’s approach to this using Subtypes. This paper by Cardelli, Donahue, Jordan, Kalsow and Nelson does a great job of explaining Modula-3’s simple but powerful type system. Not all of the subtypes in M3 make sense in a .NET world. We already have a well defined type system and some of the constructs would not mix. One concept that I think would mix well is range subtypes. Imagine that you know a value is always going to be between zero and 100. You can define a subtype of int and use that type throughout your program. The compiler actually checks that variables of this type are never out of this predefined range. Type Conversion is automatic from int subtype to int type, but not the other way. It is awesome if for nothing other than eliminating IndexOutOfRangeException on array indexers.