Page 1 of 1

Cobra October 2008 Update

PostPosted: Thu Oct 23, 2008 10:34 am
by Charles
(This can be responded to on the Discussion Forum.)

This is a new update for October, covering improvements since the last update on Sep 18

Note that using Cobra out of the source code repository is fairly safe because we accumulate stability through our automated regression suite, currently containing 700 test programs.

And using Cobra out of the repository has always been fairly easy, but now it's a lot easier because there is a new "install-from-workspace" script available to build Cobra correctly and install it into your system. This is handy in general, but especially for people who are getting the latest source just to get the latest version.

On Windows, to run the installer for the first time, you do the following. On Vista, you may need to run as admin or power user.

> svn co cobra-workspace
> cd cobra-workspace/Source
> install-from-workspace

On Mac/Linux/Unix:

$ svn co cobra-workspace
$ cd cobra-workspace/Source
$ sudo ./install-from-workspace

The output will give you information about installation location and PATH.

If you already have a workspace start with before running the installer:

* cd cobra-workspace
* svn up
* cd Source

...on any platform. Then run the installer.

-- Documentation located at the AdditionalDoc wiki page has been improved and expanded, thanks to user "hopscc".

-- Editor support continues to grow thanks to the efforts of the community, especially user "gogobyte". We collect relevant links and files at the EditorSupport wiki page.

The following improvements are due to patches and feedback from the community as well as my own efforts. Thanks to all contributors!

Command Line

-- The cobra.exe command line can now pass arguments down to the program it is running by using -- as a separator:

> cobra myprog -- arg1 arg2

...That will compile and run "myprog", passing it "arg1" and "arg2" as command line arguments. These are accessible is Cobra source via CobraCore.commandLineArgs which returns a list of strings.

-- Improved the "cobra -doc" behavior (used for generating documentation from source code).

-- The Cobra.Lang.dll is now referenced by default, rather than embedded in your program. This reduces program size and compilation time. You can still embed by explicitly asking for it with "cobra -embed-run-time:yes ..." or its shortcut name "cobra -ert:yes ..."

-- Added new -include-traces:yes/no option which defaults to "yes". Specifying "no" will cause "trace" statements in the code to be ignored. Furthermore, the -turbo option now includes -include-traces:no congruent with its other flag alterations such as -include-asserts:no, -include-tests:no, etc.

-- The cobra.exe command line recovers more gracefully in some areas involving file I/O and process launching.


-- You can invoke methods on primitive values such as c.isUpper. These include mathematical methods such as x.round, x.round(decimals), a.min(b), x.sin, x.truncate, etc.

You can also invoke methods on primitive types such as decimal.parse(s).

This is all documented at PrimitiveTypeMembers

-- Multi-target assignment is fairly new and may need some maturing, but this works now:
x, y, z =

-- The "use Foo.Bar" directive will now automatically reference the library/DLL of the same name if it needs to. If the library has a different filename then you can say: "use Foo.Bar from SomeFileName". You can wrap the filename in single or double quotes, if needed.

-- New compiler directive "args" lets you embed command line options directly in your source code. In this way, you don't have to remember to include those options on the command line every time you run or compile.

-- New compiler directives "error" and "warning" allow for programmer-defined messages at compile-time.

-- Improved error checking for "throw" and "raise". Improved the readability of some error messages (throw, raise, use).

-- Renamed "fake" to "extern" although the former will still work for some time.


-- Fixed at least ten bugs.

-- Progress was made on refactoring the Cobra compiler code base in anticipation of having multiple backends such as pure DLR and JVM.

The next update will be next month, towards the end of November, but you can always keep up to date by browsing through the discussion forums.

I hope you'll try the new install-from-workspace and give Cobra a spin!

Best regards,