So, we’ve got Jython and IronPython as Python language reimplementations. There’s also Boo, which is clearly heavily inspired by Python but has some interesting extensions (static typing, for example). I just came across Cobra.
Cobra, like Boo, is built on the .NET platform. The syntax is clearly inspired by Python, which I consider a good thing. In keeping line noise to a minimum, Cobra even ditches the “:” at the end of the line preceding a block of code. Chuck Esterbrook has also pulled inspiration from a number of other places. I recognize some D and Eiffel in there (it’s got design by contract and unit tests built right into the classes). There’s a comparison to Python available right on the Cobra site.
Something that’s interesting about Cobra is that it’s self-hosting. Even though C# has been getting more powerful over time, I’m sure that Cobra can move forward more quickly with its even more succinct syntax.
As a Python guy, though, I can’t help but notice things that seem to be missing (or are possibly just missing from the docs).
- Functions as first class objects. All of the examples are inside of classes, which just seems silly. I also haven’t seen the syntax for passing a function around (can you even do that?) This is a powerful feature.
- Metaclasses don’t seem to exist in Cobra. You don’t need them all the time, but you can make some APIs a lot nicer if you use them when appropriate.
- Function parameter declaration is weaker. Function parameter capabilities seem to be the same as in any other .NET language. It allows you to have variable arguments, but that’s about as fancy as you can get.
- Objects are not extensible. You can’t just go and hang random attributes off of an object, and there are actually some times when this is convenient to do.
I do think it’s interesting to see more languages popping up that offer both static and dynamic typing. I’ll be curious to see how that plays out over time.