Modern Language Wishlist
I was brainstorming the other day about features that I expect to be easy in modern programming languages (plus libraries).
Some of them are very common, some less common, and some might not exist yet. Some are basic services of the runtime and some are more conveniences for interacting with the modern networked world.
None of them are impossible. I can point to examples of each of them in popular programming languages. But there is no language that has all of them. A lot of progress could be made with fortuitous curation of existing libraries.
String manipulation
String manipulation should be incredibly convenient. It's so common to parse something out of a string, or build up a new string. It should be so easy it disappears.
- Regular expressions
- Splitting
- Joining
- Replacing
Polymorphism
Polymorphism, as I'm describing it here, means the specific type of a value is an implementation detail that I can ignore. I can program to an "interface" and two values that implement the same interface can be treated interchangeably.
Basic "container" types
I don't think it's a stretch to say that we know enough, as a science and industry, to know exactly what we need from our containers. +1 for convenient syntax.
- Linked list
- Dynamic array
- Hash map
- Set
Input/output
It's still a little hard in some languages to read and write files. Especially binary.
Web requests
Our computers are approaching 100% time on the Internet. And the web is ubiquitous. You should be able to do web requests with one line.
URL Manipulation
URL's are very structured strings, but that doesn't mean we should be concatenating the strings ourselves. There needs to be a way to build URL's and break them into their individual components.
Garbage Collection
I just don't want to worry about memory management anymore.
Namespaces
It is convenient to avoid naming conflicts as your library ecosystem grows.
Homoiconic
Code can be manipulated as data.
Extensible syntax
I find I don't use macros much anymore. I do more with data-driven programming. But it is nice to have when you need it.
Math-oriented numeric types
There are times when I want numbers that are defined by their machine representations, such as C
int
anddouble
. I'll call this "machine-oriented numbers". There are times when I want a more abstract representation of numbers, that act like they taught me in Math class. I'll call this "math-oriented numbers".With math-oriented numbers, the fear of overflowing should not exist and division is division.
While we're at it, we could add in matrices, vectors, and even equations.
Units
Numeric values should be able to be qualified with a unit. You should be able to convert between units of the same kind.
- Mass
- Time
- Distance
- Temperature
- and combinations of the above (speed, acceleration, etc.)
Time
Time, dates, and calendars are hard. The language should solve the hard part for us.
Error
A number is rarely 100% accurate. There should be ways to represent the error and have it accumulate when combining different values. +1 for tracing the sources of error.
Unification / pattern matching
It's just for convenience. The important thing is how unification errors are dealt with. Hopefully, there is something better than catching an exception.
Before / after functions
This is sometimes known as aspects. But there is a lot of value being able to add functionality to existing functions without modifying the original code.
Parser
Convenient way to define parser grammars that generate AST's available in the language.
CSV library
CSV is a very common way to store tabular data, but it's not really a standard. There is enough variability in the format that a library is called for.
Good error messages
Good error messages need to help you locate and solve the problem. It's actually really hard to get right. You can see this a lot in newer languages. Languages with helpful errors are typically mature.
Immutable values
Values are values. They shouldn't change.
Explicit model of time
It is very rare to find in programming languages. Time needs to be modeled by the programming language so that we can sanely deal with concurrency. This is one of the bigger mini-revolutions happening in programming at the moment.
Graphics
Most languages make it really hard to draw on the screen. This just needs to be easier. Displaying images, shapes, colors, text, video, and associated manipulations: scaling, rotation, translation.
Sound
Same goes for sound: playing sounds should be easy! Listening to the microphone should be easy!
Common file formats
Reading common formats should be easy. At the very least, there should be a framework/convention for libraries for common formats to follow.
Game input
By this, I mean getting raw events about key down, key up, mouse movement, etc.
GUI
First-class functions
Higher-order programming is an obvious win. +1 for lexical closures. +1 if you can store the functions to disk and read them back in!
Easy way to store data in flat text files
I don't want to have to write my own serialization routines.