Cobra 0.9.4 Release Notes


To get Cobra 0.9.4, visit  Downloads.

Below are the changes included in this release. There are 15 minor refinements and 21 fixes. At this point, the Cobra language is very stable and we're mostly refining and fixing as we put it into practice.

For even more details, browse the revision log which includes check-in comments and source code changes.

This release still supports .NET/CLR 2.0, 3.0, 3.5, 4.0 and 4.5. The next release will only support .NET 4.0 and higher (.NET 4.0 is now three years old). Cobra also runs on Mono and is tested on both Mac and Linux.


  • Added readonly keyword.
  • Improved parsing of method sections with respect to contracts, test and body.
  • Fixed: Enum members that are the same name except in case cause an internal compiler error. Add error check: Cannot have members with the same name in different case ("foo").
  • Fixed: Incomplete support for vari nilable parameters


  • When method calls have incorrect number of arguments or types, give the method sigs.
  • Turned off reflection-only assembly loading. Use only if the COBRA_REFLECTION_ONLY environ var is set to 1, true or yes.
  • Fixed: Some in expressions, especially those against arrays, can give an invalid error message.
  • Fixed: A single line comment made with /# ... #/ silently truncates the source file.
  • Fixed: The compiler can fail with an internal error when reading certain libraries (generic extension methods with test sections).
  • Fixed: The compiler can produce an internal error in obscure situations involving lambda expressions that have an error.
  • Fixed: Unfinished multi-line comments are silently ignored.
  • Fixed: An inline comment nested inside a multi-line comment is erroneously treated as the end of the multi-line comment.
  • Fixed: Arrays of nilables produce false compilation errors.
  • Fixed: Shared constructor wants to initialize instance variables of reference types.
  • Fixed: In compile-time error recovery situations, there are extraneous warnings regarding the inherits operator and the passthrough type.
  • Fixed: Cobra internal error on mixin method collision.
  • Fixed: Poor error message for whitespace between method name and opening paren for a call.
  • Fixed: -test option doesn't handle @args -target:lib
  • Fixed: False compilation error for complex expressions involving indexing followed by calling ([i]()).
  • Fixed: Internal error on some forward references.
  • Fixed: A program left unfinished in a parameter list results in a Cobra internal error.
  • Fixed: Line numbers mysteriously jump around during debugging. Has to do with local vars.

Library / Run-time

  • Added new CobraCommand class to the std lib for conveniently finding and invoking the Cobra command line program from within Cobra. Example usage is:
    r ='-c foo.cobra')

There are more details in the doc strings. This will subsume the CobraCore.findCobraExe shared methods that do the same thing.

It is now easier to specify that you want the .exe and not just the cobra script (CobraCommand.find vs. CobraCommand.findExe).

New env vars COBRA_COMMAND_PATH and COBRA_EXE_PATH are supported. Old COBRA env var is not.

  • Split CobraCore.runAllTests into .runAppTests and .runAllTests.
  • Optimization: Add an In() run-time support overload for int arrays.
  • Fixed: Dynamic arithmetic operations throw an exception when used with small int types (int16 for example).
  • Fixed: CobraCore.findCobraExe can fail to find cobra.exe when run under sudo as in sudo mono foo.exe.

Command Line

  • New -show-shared-data option used during compilation will output all shared/global data in the program.
  • Give a proper error message for -pkg: if the pkg-config command cannot be found.
  • The output from -timeit can be unreadable in some environments.
  • For -turbo, don't exclude trace statements anymore.
  • Added -embed-version compiler option. Embed a version string in the generated assembly. If version is not explicitly given, embed the current Cobra compiler version.


  • Check for another error condition where the installer package has the same path as the install target.
  • Fixed: Fails awkwardly when placed at target directory.


  • Improved Samples/Sizes?.cobra.
  • dump-assembly.cobra
    • Moved from Source/ to Supplements/ as originally intended
    • Support reading a filename (rather than just a partial name or assembly name).


Cobra is a community-driven, open source project under the MIT license. For this release, thanks go to:

  • nerdzero
  • hopscc
  • kobi7
  • Ajrat
  • DelphiGuy
  • torial
  • didrik
  • nevdelap

Additional people contributed through testing and discussion.

See Also