Cobra Language Slithers into Open Source

By Darryl K. Taft  |  Posted 2008-02-29

Cobra Language Slithers into Open Source

The Cobra language, which is based on Python and supports .Net, has gone open source.

Chuck Esterbrook, a language enthusiast and consultant, created the Cobra language over the last year, working full-time on the project and funding the effort through winnings from a poker tournament. Now, as the language approaches a 1.0 release-it's currently at Version 0.7.4-Esterbrook is not trying to call anyone's bluff. Now that the technology is open-sourced and available to the community, he is hoping to generate some buzz and hopefully see a vendor such as Microsoft or Novell take an interest in the language, he said.

Cobra is an object-oriented, imperative language that embraces unit tests, contracts and other features. Esterbrook said it is a general-purpose language that runs on both .Net and Mono, as well as on Windows, Mac, Linux and Solaris.

Esterbrook presented the latest news on Cobra to the Southern California Python Interest Group Feb. 28 and took the technology to open source the next day via an MIT license. He had shown the technology in January to a group of programming language enthusiasts at the Lang.NET Symposium on Microsoft's campus in Redmond, Wash.

The language also features a series of productivity boosters for developers, including clean syntax, superior run-time performance, and static and dynamic typing.

Esterbrook said his key influences in creating the Cobra language were "the big four," namely Python, C#, Eiffel, and Objective-C. However, other languages such as Visual Basic, D, Boo and Smalltalk played a part.

"Cobra was originally conceived of as a cross between Python and Objective-C," he said.

Meanwhile, Cobra supports both dynamic and static typing. "Programmers should choose, not language designers," Esterbrook said. "You don't have to switch languages to switch approaches."

Dynamic languages are flexible, allow for fast coding and prototyping, and are less brittle with respect to changes and more reusable, Esterbrook said, while static languages offer compile-time detection of errors, report multiple errors at once and are fast at run-time.

Cobra weaknesses and advantages


The Cobra compiler is self-implemented, or "self-hosted," Esterbrook said. He said he chose C# as a back end over Microsoft IL (Intermediate Language) because of the growing number of super-virtual-machine features in C#, faster implementation and the ability to piggyback on error checking and command-line options.

However, Esterbrook said there are some weaknesses in Cobra, such as its lack of maturity and lack of IDE (integrated development environment) plug-ins.

When compared with Python, he said, Cobra has better error checking, compile-time nil tracking, first-class contracts and unit tests, speed, default to accurate math, syntax, and self-hosting.

As for the future, Esterbrook said he plans to create a "Visual Cobra" plug-in for Microsoft Visual Studio.

His goal for Cobra is for is for it to "be the best, most productive, high-level, general-purpose OO [object-oriented] language." He also plans to build in support for Microsoft's Language Integrated Query, as well as integration with Microsoft's Dynamic Language Runtime.

Other future features will include more sophisticated unit test features, support for units of measurement, such as feet and meters, compile-time analysis of contracts, multiple back ends, such as the JVM (Java virtual machine) and Objective-C, support for parallel programming, lazy arguments, macros, and leveraging even more of the .Net advances, Esterbrook said.

James Shamenski, a developer and founder of AdventureLink, said he was impressed with Esterbrook's presentation.

"When I was looking to choose a programming language for my most recent project, I interviewed all the usual suspects," Shamenski said. "Ruby is too slow for customers out of the gate. C# takes too long to develop. Python is a pain to test. Each language has [a] strong upside and Cobra amalgamates the positive aspects ... I want rapid development and lightning performance without sacrifice. That is the executive promise of Cobra. What coder and suit wouldn't listen to that? Even fragmented engineering teams from different backgrounds can now come together [and] that was the tipping point for me."

Shamenski said he was skeptical going into the Cobra talk, but that changed. "I would definitely be interested in interviewing developers who wanted to use Cobra," he said. "For someone who thinks that this may be a fit for their future project, I would spend the next three to six months helping out the open-source Cobra community to add the features you see needed. In a few months when you are ready to begin, Cobra will be ready for prime-time production and probably save your sanity in the process."

Esterbrook is now creating a wiki and an issue tracker for Cobra that should be done within a week. Developers interested in having a look at the language should go here.

Rocket Fuel