Martin Heller
Contributing Writer

Cobra is an interesting work in progress

analysis
Feb 10, 20082 mins

I'm grateful to Savio for mentioning the Cobra language in his Open Sources blog. I had a look at Cobra this weekend, and found it rather interesting. Microsoft has always touted the .NET Framework as being language-agnostic. In the early days of the Framework, that sounded more like coordinated PR than a real technical characteristic of the Framework. As it turns out, though, it was true. C# may be the premier

I’m grateful to Savio for mentioning the Cobra language in his Open Sources blog. I had a look at Cobra this weekend, and found it rather interesting.

Microsoft has always touted the .NET Framework as being language-agnostic. In the early days of the Framework, that sounded more like coordinated PR than a real technical characteristic of the Framework. As it turns out, though, it was true.

C# may be the premier .NET language, because that’s the language in which most of the class libraries are written, and Visual Basic .NET may be a close runner-up. But there are dozens of other languages written for the .NET Framework, with a range of styles and amenities. Some of these are from third-party language developers — Eiffel comes immediately to mind — and some are from internal Microsoft groups, like the ML-derived F# language from Microsoft Research. Still others are or were open source efforts: a classic example is Jim Hugunin’s IronPython, which is now sponsored by Microsoft.

In some ways, Cobra reads like a blend of Python and Eiffel. It uses indentation like Python, and supports contracts like Eiffel. It has additional influences, listed here.

When I talk about a new programming language, I usually start with its “Hello, World!” program.

"""
This is the infamous "Hello, world." example.

And this text you are reading right now is the "doc string" for the whole
program. You can also put doc strings underneath classes, class variables,
methods and properties.
"""

class Hello

    def main is shared
        print 'Hello, world.'

That little sample doesn’t do justice to the language, however. This page explains some of the key features. The Wordcount sample illustrates Cobra’s inline tests and object-oriented programming in a reasonably sized program that actually does something.

It’s worth downloading Cobra and trying it yourself. You’ll need .NET 2.0 or Mono. Don’t expect Visual Studio integration, Windows Forms support, debugging support, or even a syntax-aware editor. Do expect an interesting language for console applications that’s on the verge of becoming useful.

Martin Heller

Martin Heller is a contributing writer at InfoWorld. Formerly a web and Windows programming consultant, he developed databases, software, and websites from his office in Andover, Massachusetts, from 1986 to 2010. From 2010 to August of 2012, Martin was vice president of technology and education at Alpha Software. From March 2013 to January 2014, he was chairman of Tubifi, maker of a cloud-based video editor, having previously served as CEO.

Martin is the author or co-author of nearly a dozen PC software packages and half a dozen Web applications. He is also the author of several books on Windows programming. As a consultant, Martin has worked with companies of all sizes to design, develop, improve, and/or debug Windows, web, and database applications, and has performed strategic business consulting for high-tech corporations ranging from tiny to Fortune 100 and from local to multinational.

Martin’s specialties include programming languages C++, Python, C#, JavaScript, and SQL, and databases PostgreSQL, MySQL, Microsoft SQL Server, Oracle Database, Google Cloud Spanner, CockroachDB, MongoDB, Cassandra, and Couchbase. He writes about software development, data management, analytics, AI, and machine learning, contributing technology analyses, explainers, how-to articles, and hands-on reviews of software development tools, data platforms, AI models, machine learning libraries, and much more.

More from this author