Ian Bicking: the old part of his blog

And Boo Makes Three

I just came upon Boo, a CLI (.NET) language. It's statically typed, but the syntax is based on Python. With Pyrex and Prothon, that makes three recent languages inspired by Python.

The manifesto (PDF, ick) seems like the best description of the language.

  1. Timespan and regular expression literals. (Timespan seems like a weird choice)
  2. String interpolation, like "Hello \$name!". Only in double-quote strings, not single-quote. I find that very annoying, the equivalence of these quotes in Python is a good feature. I've cursed PHP for this. Maybe in shell this makes sense, but not in a normal language.
  3. Statically typed. But...
  4. Type inference, so you don't have to declare types too often, unless you want to. Of course, you need all your code bundled up before hand to do inference, where Python only looks at code on an on-demand basis. But in practice all the code is usually available.
  5. Variables are somewhat casually declared. Whenever you first use a variable, use as type to indicate the type (if necessary). Like def func(a as int, b as str).
  6. Duck typing, i.e., Python's typing (if it looks like a duck and quacks like a duck, it must be a duck). When you really don't care about type signatures.
  7. Syntactic attributes. I don't fully understand the mechanism here, but it's a lot like Python's decorators, and uses the proposed syntax for decorators. I think it might be a little more general than descriptors, perhaps in part because it may work at compile time.
  8. Macros. They seem very complicated to implement, but basically you can manipulate the compilation, inserting your own transformation into the process. I don't know if this causes problems with debuggability -- debuggability is frequently a feature left out of languages in the early days, when it should be a major concern. If used sparingly, this could be a nice feature. (I bet you could make lazy introspectable expressions this way!)
  9. Some minor things. print is a function. Assignment is an expression (like if (var = func()) is not None:). It doesn't use self in method signatures or method bodies. Instance variables become local variables. I don't mind the signature bit, but I like using self.attr for instance variables. finally: is called ensure:

Prothon also had another release just a week ago. The changes all seem pretty good -- lots of little syntactic nits in Python are corrected. E.g., default values for function parameters are evaluated when the function is called.

Created 16 Jul '04
Modified 14 Dec '04

Comments:

The URLs (which seem to be missing):

Boo: http://boo.codehaus.org/
Manifesto: http://boo.codehaus.org/BooManifesto.pdf

Having skimmed the manifesto briefly, there doesn't seem to be much about classes and inheritance, and the type inference section on the site is tantalisingly missing. However, the existence of decorators and macros should fuel the debate about their introduction into standard Python, and I could imagine the Twisted people finding the asynchronous stuff of interest.
# Paul Boddie

Great stuff. Especially the type declarations and type inference... it can prove to be educational for cpython as well.

There are some perlistic warts (regex and timespan literals, dostuff() while foo()), but I assume they will be removed as the project matures.

This project might benefit from some co-operation with IronPython...
# Ville Vainio

In skimming through the example code, I felt that this was more a "terse C#", rather than Pythonesque or similar..maybe it was just the lack of duck typing and peppered attributes. More palitable to see as an easier C#, and I'm used to the Pythonic view of C# as wordy.

The Python acknowledgement and documentation humor are appreciated. Thanks for the thorough technical review.
# DeanG

OSNews reports that IronPython a .Net dynamic language has been open sourced here. What it doesn't mention is that its creator has joined the MS CLR team as reported a little bit further down here: http://www.ironpython.com/
# mike