| Usual file extensions | .cobra |
|---|---|
| Paradigm | |
| Appeared in | 2006 |
| Designed by | Chuck Esterbrook |
| Developer | Cobra Language LLC |
| Latest release | 2009-03-20/ March 20, 2009 |
| Typing discipline | strong, static, dynamic, inferred |
| Influenced by | Python, Eiffel, C#, Objective-C |
| OS | Microsoft .NET, Mono |
| License | MIT |
| Website | http://cobra-language.com/ |
Cobra is an object-oriented programming language produced by Cobra Language LLC.[1] Cobra is designed by Chuck Esterbrook, and runs on the Microsoft .NET and Mono frameworks.[2] It is strongly influenced by Python, C#, Eiffel, Objective-C and other programming languages.[3] It supports both static and dynamic typing.[4][5] It has first class support for unit tests and contracts.[4] Cobra provides both rapid development and performance in the same language.[6]
Cobra is an open-source project. It was released under the MIT open source license on February 29, 2008.[7]
A monthly update is posted to the Cobra news forum with progress on features, fixes, documentation and related projects since the last update.[8]
Contents |
Features
- Object-oriented:
- Namespaces
- Classes, interfaces, structs, extensions, enumerations
- Methods, properties, indexers
- Mixins, extension methods
- Generics, attributes
- Quality control:
- Contracts, assertions
- Unit tests, docstrings
- Compile-time nil-tracking
- Expressiveness:
- Static and dynamic binding
- List, dictionary, and set literals
- in and implies operator
- for expressions
- Slicing
- Interpolated strings
- Compile-time type inference
- Lambdas and closures
- General productivity:
- Exception handling
- Postmortem exception report
- Garbage collection
- Scripting conveniences:
- Clean syntax
- Dynamic binding
- One-step run
- Shebang line (#!)
- Miscellaneous:
- Doc tool (cobra -doc)
- Syntax highlighting tool (cobra -highlight)
Examples
The following examples can be entered into a file and run using cobra <filename>.
Classic Hello world example:
class Hello def main print 'Hello, World'
Simple class:
class Person var _name as String var _age as int cue init(name as String, age as int) _name, _age = name, age def toString as String is override return 'My name is [_name] and I am [_age] years old'
References
- ^ The Cobra Programming Language home page
- ^ The Cobra Programming Language, C. Esterbrook, Lang.NET Symposium 2008
- ^ Cobra takes a bite at open source, Adrian Bridgwater, ZDNet UK, Mar 2008
- ^ a b Reaping the Benefits of Cobra, Ted Neward, MSDN Magazine, June 2009
- ^ Was George Costanza a Computer Programmer?, Jonathan Erickson, Dr. Dobb's Journal, April 2008
- ^ Cobra language slithering to open source, Paul Krill, InfoWorld, Feb 2008
- ^ "The Cobra Programming Language". http://cobra-language.com/downloads/source/. Retrieved on 2008-02-29.
- ^ Cobra News Forum
External links
- The Cobra Programming Language home page
- The Cobra blog by Chuck Esterbrook
- Cobra News Index
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)




