The Cobra Programming Language Version 0.0.8 Release Notes 2006-04-23 ------------------------------------------------------------------------------ See also: Cobra\ReadMe.text Cobra\Docs\License.text http://CobraLang.com/ In this release: == Additions == * Added ? as both a "nil coalesce" binary operator and a unary postfix operator for nil detection. For example, def doSomething(stuff as Object?) if stuff? # detect nil print 'Will use default stuff.' stuff = stuff ? .defaultStuff # coalesce nil * Added ! as the inverse of ? as both a binary operator and a unary postfix operator. def doSomething(input as String) if input! # detect not nil print 'Received some input.' i as int? = input ! string.parse(input) # coalesce non-nil * Added "fake classes" which are useful for defining APIs since Cobra does not yet scan assemblies for their symbols: class TextWriter is fake get newLine as String pass * Added two examples: * google-api.cobra - Use the Google Search API. * webpages.cobra - Generate HTML for a website modeled with OO inheritance. * C# files can be passed on the Cobra command line to be included in the final compilation. This is convenient for quickly incorporating the output of a C# code generator like wsdl.exe. * More than one Cobra source file can be passed on the command line. == Changes == * Compiler options must now be passed with dashes (1 or 2, your choice). cobra.py --run foo.cobra cobra.py --compile --debug foo.cobra Running the program (after compilation) is still the default when no options are passed: cobra.py foo.cobra * The compiler no longer emits debug information by default. There is a new --debug option for that. * Access to methods and properties of the current class has to be preceded by a period or an underscore (as was originally intended). Previously, the compiler crashed without the prefix. Now it gives a normal error message. def computeTotalRevenue total = 0 for payment in .payments # <-- short for this.payments total += payment.total _totalRevenue = total # _totalRevenue is a protected field == Fixes == * Fixed a bug regarding nilable cross references between classes. * Explicit local variable declarations (ex: x as int) could not start with an underscore, but implicit ones (ex: _x = 0) could. The implicit ones no longer can, as originally intended. This prevents silent errors caused by mispelling class variables in constructors. ------------------------------------------------------------------------------