A very non-esoteric language

David Stark / Zarkonnen
9 Jan 2014, 11:31 a.m.
I was thinking the other day: there are plenty of esoteric programming languages - but how about a really non-esoteric, actively boring one? This is my take on it: an imperative, non-OO, garbage-collected, strongly and statically typed mixture of all the most standard bits of C, Java and Javascript, with as many surprises removed as possible. Note that I'm not advocating that this is a good language design, just a mildly amusing one.

Data Types

The following primitive data types are available: boolean, unsigned byte, integer, float. Beyond that, there are also fixed-size typed arrays, e.g int[], and heap-allocated data structures with typed fields and no inheritance, e.g:

struct Kitten {
    byte[] name;
    int age;
    boolean purring;
}

Arrays and data structures are allocated on the heap, are garbage-collected, and can be null. Manual memory management would be too exciting. And yeah, strings are just mutable byte arrays. Who needs unicode?

Variables are strictly typed: there's no equivalent of void* or Object. There are no implicit conversions: if you want to add a byte to an int, you better convert the one or the other first.

Functions

You can define functions, which all go into the same global namespace, and have a fixed number of typed arguments, eg:

void ennoble(Kitten k) {
    k.name = "Lord " + k.name;
}

Library Support

There is a tiny standard library that takes care of IO, basic string operations, networking, and basic mathematical operations. All functions in the standard library are automatically imported and available. Beyond this, it's possible to use the import(byte[] path) function to load and execute some other piece of boring-lang code from the path specified. Again in the same namespace. Perhaps there's also a function to load in extra libraries from opaque code blobs.

Error handling

There are no exceptions or try/catch. Failing functions return a status code or boolean value, or Null. Trying to dereference Null or access an illegal array index prints an error message to stderr and then exits the program. I hope you like defensive programming.

Conclusion

Just to make it clear, this isn't meant to be a language you'd actually want to use, or that I would want to implement. It's a thought experiment about what language features are considered "normal".

It's not that the language is absolutely awful - you can totally do things in it, and you'll not get any real surprises. But your code is going to be very long and boring too...