LWN.net Logo

Boo - a wrist-friendly language for the CLI

May 23, 2007

This article was contributed by Joseph Quigley

Imagine taking a Ford engine, a Chevrolet chassis, and a Toyota transmission, bolting them together, and discovering that they fit perfectly. In the programming world, Rodrigo Barreto de Oliveira created such a vehicle. Around the year 2003, de Oliveira was unhappy with some of the .Net/Mono languages at the time because none of the stable ones were Python-like.

De Oliveira said that he missed the "wrist-friendly" Python syntax. He created his own language, Boo, and explains in the Boo Manifesto [pdf]: "I wanted a language I could extend with my own constructs. I wanted a compiler system that could be taught new things, taught how to automagically [sic] generate common code for me." The language caught on, and several sites hosted Boo projects or created communities around it.

[Boo]

Boo is an object-oriented, statically-typed programming language that makes use of the .Net Common Language Infrastructure. It is licensed under an open-source MIT/BSD-style license, and because it is built upon the Mono or Microsoft .Net framework, it is cross-platform and can be extended significantly. Boo supports Unicode, internationalization, and web-style applications while its language's syntax is Python-inspired. Focusing on both language and compiler extensibility, it features type inference, optional duck typing, currying, first class functions, multimethods, and generators.

The language is quite flexible and adapts to many genres of programming. It can be used in or written for games, GUI applications and web frameworks (see the Boo Applications). It can interact with most Mono libraries, every CLS-compliant library and most generics. In short, it works with pretty much everything, every library, and every framework for .Net or Mono. In the game world, BooGame (a 2D, OpenGL-accelerated, game engine framework) is similar, if not almost equivalent, to PyGame.

The commercial Mac OS X Unity game engine has very good support for Boo scripting for both 2D and 3D games. With Unity, Boo games can even be played from a browser. Unity is not the only 3D framework that supports Boo. The open source Tao framework supplies OpenGL, Ogre, and OpenAl bindings for Boo on both .Net and Mono. Although not too many web frameworks have been written for Boo, Apache's mod_mono makes web development possible. A popular framework is Webbness, which delivers functionality similar to Ruby on Rails and it generates code in either Boo or C#.

There are several reasons to use Boo over other languages, even though many others (such as Lua) may have a larger community, have a larger software base, or may be in the news more often. Boo stands out from the crowd since it is appealing to developers due to its simple syntax and well implemented OOP functionality on the .Net/Mono platform. It differs from IronPython in several ways because it can provide features and tools that IronPython might never support (due it its very good compatibility with standard CPython).

Unlike some languages, Boo is not designed to replace or be used exclusively as an alternative to C#. Instead it was designed to be extended and to interact with those languages. This allows the programmer to write once in a different languages, and use his code with Boo. In the Boo Manifesto, de Oliveira explains why he created the language. "When I was programming in full Python mode I missed some of the things I'd normally get from a more statically typed environment." He goes on to say, "what I missed the most was the well thought out .net architecture and its great support for Unicode, globalization and web style applications."

Just recently Boo 0.7.7 was released, touting new features primarily involving support for consuming generic methods. For example, in Boo 0.7.6 one could only use generics with external types. Boo 0.7.7 improved generics support, allowing the programmer to use generics with internal types (which are defined in the Boo assemblies that are to be compiled). It also improved the verify pipeline, making it available on Mono (the pipeline in 0.7.6 only worked well in .Net) and optimized string handling (allowing the coder to generate Gendarme/FXcop-compliant assemblies). Type inference (which is a work in progress) was improved and the release fixed a handful of bugs, mostly inconsistencies in the Boo compiler.

Boo releases come frequently (see the Boo Release Schedule). The team uploads a new sub-release every month to fix bugs and add a few features. The next major version, Boo 0.8, is in active development and the team is working on improving the compiler even more. Although there isn't much information on the upcoming 0.8 release, the bug tracker has some reported issues with the improved lexical and method syntax as well as some interpreter and duck typing improvements.

Boo was created to fill gaps in Python in order to make a programmer's job even easier. Its syntax makes programming a breeze and it can be extended to work in dozens of scenarios. Whether one wants to create a game, a web site or a GUI application, Boo can lighten the load. The programmer can concentrate on nitty-gritty programing in a different language, while Boo effortlessly interacts with that language. Almost every other module can be found in the .Net/Mono framework.

Resources


(Log in to post comments)

Boo - a wrist-friendly language for the CLI

Posted May 24, 2007 7:17 UTC (Thu) by flewellyn (subscriber, #5047) [Link]

I can certainly attest to Boo's usefulness, since I had to write a program to interact with a
proprietary COM+ library through the .NET interop. This library, I might add, was severely
lacking in documentation.

I suppose I could have learned C#, since it's similar to Java, but I would prefer to program in
something that feels like it has learned the lessons of the last 20 years of computer science. Boo
provides that: it's flexible, lightweight, interactive, full of advanced programming features, and
avoids unnecessary bureaucracy. But, since it compiles down to the same CIL as any other .NET
language, it not only can interoperate seamlessly with any .NET or Mono library, but gets the nice
speed boost of the CLR's JIT compiler.

Boo saved the day for me, I tell you.

Another day, another language...

Posted May 24, 2007 12:21 UTC (Thu) by asamardzic (guest, #27161) [Link]

Not that I know much about .Net platform, but - what's wrong with IronPython?

Another day, another language...

Posted May 24, 2007 18:03 UTC (Thu) by bronson (subscriber, #4806) [Link]

From the article:

> In the Boo Manifesto, de Oliveira explains why he created the language. "When I was programming in full Python mode I missed some of the things I'd normally get from a more statically typed environment." He goes on to say, "what I missed the most was the well thought out .net architecture and its great support for Unicode, globalization and web style applications."

Another day, another language...

Posted May 24, 2007 18:13 UTC (Thu) by bronson (subscriber, #4806) [Link]

Actually, I think IronPython inherits the CLR's strong Unicode support and globalization. Strike those from my reply.

I do like Boo's defaulting to static typing to catch lots more errors at compile time and, in the few circumstances where duck typing is handy (i.e. heterogeneous array of objects), Boo offers a "duck" type. Sounds very practical.

Sorry for hitting "submit" too early. :)

Another day, another language...

Posted May 26, 2007 15:32 UTC (Sat) by k8to (subscriber, #15413) [Link]

Last I checked there was a bit of a legal liability cloud around IronPython, has that changed (again)? There was a minor backpedal on license terms but many folks were unconvinced. I put some effort into unravel the core issues but gave up out of disinterest in the .net runtime.

Copyright © 2007, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds