Multi-type return functions.
- Code: Select all
{double, string, int} ParseValue(string);
void ReadConfig(string value) {
switch(ParseValue(value)) {
case double f: {
// we have a double named f that was returned from ParseValue() here
} break;
case string s: {
// this case is reached if ParseValue returns a string
// the return value is stored in s, naturally
} break;
case int i: {
// guess?
} break;
}
}
You can do this with exception syntax in a number of languages, and do it with manual type safety in most languages.
Even better syntax might be:
- Code: Select all
auto result = ParseValue(value);
which would basically do the above switch/case statement, but with the remaining body of code being the same.
Toss in the ability to do an explicit switch on the type of the variable...
...
Full-scale compile-time code generation, where you can build functions from primitive statements hooked together.
...
Incomplete functions with "loose" external references that can be hooked up by metaprogramming. Ie, a function might have a loose variable called "chicken" that needs to be bound before it can be used. You could place it into a class, and hook "chicken" up to a class variable, or you could wrap it with another function that accepts "chicken" as a parameter.
...
Multiple parallel type systems. I want to be able to decorate something with physics-style dimensional notation, etc, but still be the same underlying computational type. Units with restricted conversion between them. Algebras with limited valid symbols. This should work at both compile and run time (often dimensional analysis can be checked before you actually execute a formula or algorithm).
...
Compile and run-time type checking. I want to be able to request compile-time guaranteed type-checking in my code, and if the compiler cannot guarantee it, it would generate an error. I also want run-time type checking when it is a better option, both automatic and manual.
...
Named arguements. Everywhere.
...
Compile-time type-safe varargs. Run-time type-safeable varargs.
...
The ability to build expression tree syntax with minimal effort. The ability to include compile-time guarantees in my expression tree syntax.
...
classes. classes of classes. classes of classes of classes. Virtual classes. Virtual classes of classes. Virtual classes of virtual classes. Classes of virtual classes of classes.
method-level polymorphism. Run-time polymorphism. Compile-time-locked polymorphism. duck-type polymorphism.
...
In essence, I want leverage. I want my language to let me rewrite large chunks of the language that is used to write the language to write my code. I want to be able to write code that writes code that writes code, and have the debugger be able to point at the code that wrote the code that wrote the code that I am running, and say "unhandled division by zero here".
That is what I want for christmas.
Anyone else?
