Monday, May 18, 2009

Cobra vs Python

I've been investigating different .net languages for use with Mono. I've spent some time with Boo, and have decided I don't like it. It feels immature due to poor syntax error reporting, and silently changes the scope of variables when there happens to be an inadvertent mix of tabs and spaces in your source code. Yuck.

Then I came across Cobra. The language comparison with Python stung a little, I guess because it had some valid points.

Cobra vs Python

There is definitely a lot of flame bait in there, but the point about being "self hosted" resonates with me.

12 comments:

Anonymous said...

s/cam/came

Simon Wittber said...

Thanks Mr Anonymou.

Michael said...

Ohh, that's an interesting little language. Might have a play...

James Thiele said...

Cobra is .Net/mono?

.Net is DOS only.

mono is the red headed cousin on *nix systems.

Robert said...

Speed comparison?

rgz said...

Sadly it still doesn't have the widespread compatibility of the original Python, but it looks like an improvement to IronPython.

So many keywords is unpythonic, using the keyword "cue" for special methods is cute but makes me worry about the implementation differences between special and non special methods.

The lack of colons make it look a little "naked" but I guess it is the good kind of nakedness.

Type declarations should follow python3.1 style instead of inventing their own. I'm uneasy about a language without dynamic classes and type declarations.

But then again I often find it hard to sell python due some slowness, being a .Net language cobra might be an easier sell, but then again I don't trust MS "promise" to not sue mono when it see fit.

illume said...

cobra is nice. More elegant syntax than python.

Also, a dictator with better taste than Guido :)

Would need to try it out on some real projects for a while first... the only this that's stopping me is the .net requirement. But I'll almost do anything to allow typing less syntax noise :)

With so many elegant usability improvements to python Cobra seems to be on a winning path.


Robert, it's much faster than any python implementation. Except maybe the shedskin/rpython subsets of python.

rgz, I think cobra was doing this stuff before py3k.

Simon Wittber said...

illume: yeah, I understand your comments about .net.

The only reason I'm straying from the fold is that I need a .net language (to be used with mono) that is more like Python than C#. IronPython is not an option unfortunately, as it can't build assemblies.

Sebastien Binet said...

hi,

I see that you have some stubs (?) to generate JVM code.
Do you plan to target that VM ?
What about LLVM ? Nowadays, all the cool kids on the street target LLVM :)

cheers,
sebastien.

Chuck Esterbrook said...

Sebastien, I'm actively working on the JVM back-end each week, but it's not ready yet.

I haven't decided what back-end #3 will be. I'm leaning towards Obj-C for the sake of building native Mac and iPhone applications. LLVM is a candidate as well.

Also, after completing backend #2 it will be easier for other devs to step in and provide their own favorite target.

Ben Sizer said...

I'm completely unsold on the 'self-hosted' argument. It seems like circular logic for someone to claim that since they like a language, it is good to code in the language, and that since it's good to code in the language, it's good to have the language implemented in that same language. If anything I think the opposite is true because higher level languages like Python, Ruby, Cobra, etc, all have limitations compared to C, C++, etc. Since those limitations are actually side-effects of benefits in other applications, you can't meaningfully fix or bypass them without damaging the language itself. The 'feedback loop' as they call it is damaging in this respect.

On the other features, static typing I'm not sold on, contracts could be useful, accurate maths might be a very good feature, if (and only if) there's a guarantee that your float operations won't be arbitrarily promoted to decimals at times unknown to you, compiling down to native code is great, and the Python-like syntax is fine.

I don't know whether the .NET libraries compare positively to the Python ones though. What little I see about them seems to be reasonable, but Python does come with quite a few handy ones that I'd have trouble coping without.

Chris Austin said...

It could be interesting but, the whole .net/mono thing makes it a nonstarter for me.

Popular Posts