A Quick Tour of Boo (Page 1 of 5 )
If you're looking for a portable .NET language and don't want to use a C-style syntax, you might want to take a look at Boo. Don't let the name spook you; if you're comfortable with Python, you'll feel right at home with Boo.
Introduction
While the de facto .NET languages C# and Visual Basic .NET are certainly capable, only the former is especially portable (in practice, that is), and users coming from scripting backgrounds or users who don't enjoy C-style syntax may not feel at home. Fortunately, however, the Common Language Infrastructure allows support for multiple languages, and these languages can be used together as the developer sees fit. Boo is one such language for the CLI. It offers the features of the .NET Framework and Mono, and it features a Python-like syntax. In this article, we'll explore the Boo language and some of its basic features.
Boo can be obtained at:
http://boo.codehaus.org
The Boo Toolbox
Boo comes with three basic tools for working with Boo code. The first is the Boo compiler, which compiles Boo code into an assembly. It goes by the name of booc:
$ booc HelloWorld.boo
Boo Compiler version 0.7.8.2559 (CLR v2.0.50727.42)
The next tool is the Boo interpreter. Instead of compiling a Boo file, you can interpret it using booi:
$ booi HelloWorld.boo
Hello World!
It's also possible to interpret code directly form standard input:
$ booi -
print "Hello World!"
print "Goodbye!"
Hello World!
Goodbye!
The final tool is the Boo interactive interpreter, booish, similar to Python's interactive interpreter. As its name implies, it allows one to interact with it, immediately seeing the results of code, among other things:
$ booish
Welcome to booish, an interpreter for the boo programming language.
Running boo 0.7.8.2559 in CLR v2.0.50727.42.
The following built-in functions are available:
dir(Type): lists the members of a type
help(Type): prints detailed information about a type
load(string): evals an external boo file
globals(): returns the names of all variables known to the interpreter
getRootNamespace(): namespace navigation
Enter boo code in the prompt below.
>>> print "Hello World!"
Hello World!
>>>
Next: Program Structure and Variables >>
More BrainDump Articles
More By Peyton McCullough