Boo is a Python-flavored language for .NET and Mono. It is statically typed, but has a “duck” type similar to the dynamic keyword in C# 4.0. It is compiled, but has strong meta-programming capabilities. Using Boo feels like using a more indie version of C#. It doesn’t have the tools support that C# has, so many .NET programmers have never heard of it, but it does a lot of interesting things that the mainstream languages aren’t doing yet.
These are some of my favorite features with examples. Some are just nice-to-haves, others change the way I think about coding in Boo versus C#.
Concise, Implicitly-Typed Variable Declaration
Concise Arrays (With Unpacking!)
Hash Literals
List Literals
TimeSpan Literals
String Interpolation
Generators
Pattern Matching
Syntactic Macros + Quasi-Quotation
AST-Manipulating Attributes
If any of that looks interesting to you, I encourage you to try it out. MonoDevelop ships with an add-in that makes it easy to get started, the language itself is open source on Github with very helpful test cases documenting the more obscure features, and there’s an active mailing list to help answer your questions.
For the more full-featured Python experience on top of .NET there’s IronPython: http://ironpython.net/ . It was recently freed from Ballmer’s sweaty grip and is now a FLOSS community project. It’s compliant with basically the full Python 2.6 and 2.7 standard libraries, and I’m told that most pure Python modules will work with it. There’s a Visual Studio plugin for it or you can find it in the SharpDevelop IDE http://sharpdevelop.net/ .
Thanks, Ben!
IronPython is a great project, as is the rest of the DLR, but Boo is a completely different animal. It was designed back before there was a DLR, therefore its creator made a lot of deliberate deviations from Python heritage in order to retain CLS compliance, type safety, and the ability to compile down to an assembly. (Along with the static metaprogramming features such as macros and its extensible compiler pipeline, which would not be as straightforward with an interpreted language like IronPython.)
There’s an effort underway to add DLR support to Boo so you can use it as a scripting language and interop easily between C# “dynamic”, Boo “duck” and IronPython DLR objects. No idea when that will be official though.
Very interesting. My day job is all about C# and .NET, but my free-time is dedicated to languages like Ruby, Javascript, etc. Very cool. It may be worth adding it to my free-time “play list”. Thanks for posting, and throwing in all those examples.