The Cobra Programming Language Version 0.1.2 Release Notes 2006-07-12 ------------------------------------------------------------------------------ See also: Cobra\ReadMe.text Cobra\Docs\License.text Cobra\Docs\Introduction.text http://CobraLang.com/ In this release: == Additions == * Implemented Eiffel-style contractual design with `require` and `ensure` for constructors, methods and properties. Use of `old` and `implies` is supported. class DemonstrateContractSyntax var _value as int get value from var def incValue ensure .value == old .value + 1 code _value += 1 def countDown require .value > 0 ensure .value == 0 code v = _value while _value > 0 print '[_value]...' _value -= 1 def multiply(x as int) as int require x > 0 ensure .value == old .value .value > 0 implies result > 0 test d = DemonstrateContractSyntax() assert d.multiply(5)==0 d.incValue assert d.multiply(5)==5 assert d.value==1 # value didn't change expect EnsureException d.multiply(0) code return _value * x * Added support for calling instances of Type (just like you can call a hard-coded class). class Factory var _inventory = List def manufacture(vehicleType as Type, count as int) for i = 0 .. count v = vehicleType() v.factory = this _inventory.add(v) ... ... f.manufacture(Car, 10) f.manufacture(Truck, 5) == Changes and Minor Improvements == * Added support for overloading indexers by argument count and type. * Added support for declaring indexers with the short `get` form: get [key as String] as Object return _stuff[key] * Argument and local variable names must now vary by more than just case. * Improved error checking when passing arguments to methods. == Fixes == * Fixed a bug with the warning about reversing assignments. * Fixed a bug at the intersection of interfaces, qualified types and inheritance. * Improved the condition source for assert, ensure and require. It now looks more like Cobra source code. * Fixed a bug where, in some cases, a local variable would cause a failure in code generation. * Fixed bug with operator precedence levels and indexing. * Fixed type inference for indexers across generic and non-generic classes. * Fixed a bug where the character c'\0' evaluated to true. * Fixed a bug where non-boolean types could not be used with `and` and `or`. * Fixed a bug where shared methods could not invoke other shared methods of the same class. * Fixed while loops to handle truthfulness just like if statements. * Fixed shared properties to be able to invoke other shared properties and methods. * Fixed substitution expressions in strings to permit indexing (which uses square brackets). * Fixed a bug regarding operator precedence and the "two keyword" operators such as `is not` and `not in`. * Fixed a bug when calling a property as if it were a method. ------------------------------------------------------------------------------