Tag Archives: Vala

Vala

Yesterday I decided to indulge my language fiddling impulse and spent some time reading about Vala and writing some simple programs in it. As far as I can tell, it is the answer to the running “My ideal language…” conversation my lab mate and I have, with only a few tiny exceptions. Even from a more formal view, evaluating based on Bruce MacLennan’s Principles of Programming Languages (not the book, just the list of aphorisms) Vala does INCREDIBLY well.

The syntax and feature set is based on C#, but instead of compiling to another unwanted virtual machine (Microsoft’s CLR or its second class citizen implementation, Mono), it compiles to (human readable) C, then native code, so it can piggyback on the platform CC. Most of the fancy language features are actually implemented with glib and GObject, so if you are running anything GTK based all the bits and pieces will be in memory anyway.

Rather than repeating the entire tutorial, the things I find exciting are: Array slicing. Proper Strings. Regular expressions. An optional garbage collector. A reasonable object system with limited inheritance and overloading. Coroutines(-ish) and iterators. Pointers of both the object-respecting and real varieties. Closures. Assertions/contract features. It also has incredibly clean interfaces for writing GUIs (in GTK) and network code, which are definitely weak points for most languages low-level enough for my tastes.

It does have a few interesting quirks (get and set methods allow you to override assignment, string concatenation is “+”, etc.), some dumb inherited things (were long and short ever a good idea?), and a handful of missing features (nothing has powerloops), but those are all minor quibbles.

The only real issues I have with Vala are that it isn’t terribly widely adopted, and that it is maintained by the GNOME foundation (which has a proud history of doing horrible things on a whim), but I think I’ll try writing all my random little bits of code in it for a while, because it is fun in a way I rarely find pure software.

Posted in Computers, General, Objects | Tagged , | Leave a comment