As discussed, I’m going through the 7 Languages in 7 Weeks (7L7W) book. The second week was about the Io Language.
For this week, I’ve been fighting with the Mac, so I’m just doing this on Windows. Simple enough, it’s just a small zip file. Run “io_static.exe” and you’re in the REPL prompt.
This Prototype language was written in 2002 by Steve Dekorte, as he was trying to learn another language. The language is pretty unusual! It is OO, sort of, in that is support inheritance. Aside from that though, it’s not like anything else I’ve run across. There is no distinction between classes and objects. It is dynamic and weakly-typed – anything goes! Most confusing is that the order of things are backwards. For example, to print something to the console:
You send the println “message” to the “String”, instead of sending a string to the printline. Also, I’m not sure how useful methods can be. See below that I create a new Car object, add a “drive” method, and then call that method:
Since whitespace is significant, any code that got even mildly complicated would turn into a nightmare to read and debug. For example, here is a longer method, implementing a Ruby-like “unless” function:
Some things are almost like an Excel function – like the if..then statement, it’s structured like if(condition, onTrue, onFalse) – and other things are pretty cool, like how you can call things like Lobby and OperatorTable:
Lobby shows you all the objects currently loaded in memory. OperatorTable is interesting because this language let’s you do a lot of meta-programming type things, which aren’t reasonably possible in other languages. For example, you can create your own operators to add to the operator table! The language does support concurrency with things like coroutines, actors, and futures.
Although interesting to see, this obviously isn’t a particularly useful language. You can’t reasonably build a website or UI from it, and for scripting, you’d probably choose something with more libraries and more support.
However, that’s not really the point. The point of going through this book is to stretch your brain a little bit, and understand how different languages work. This, to me, both helps me better understand how my favorites languages work under the hood – and make me appreciate them that much more!
Onward and updated – the next (3rd) language is ProLog…