2013-03-10 New release 2.1
This release should be mostly source and binary compatible with 2.0 series but it is recommended to rebuild your apps. If you bump into the following error[Error] else unexpected herethen remove semicolon ";" before "else".
Features in new release:
UNIX DEVICES
Basic support of Unix /dev nodes. Implemented nodes:Special files:
- /dev/null
- /dev/zero
- /dev/random
Per-process streams:
- /dev/stdin
- /dev/stdout
- /dev/stderr
COMPILER IMPROVEMENTS
1) New basic types- Byte - signed 8-bit integer
- Short - signed 16-bit integer
- Char - single character
2) No more ambiguous types BArray and CArray. They still work but you can just use [Byte] and [Char].
3) Guarded blocks seem to work stable and option -Xtry is not needed anymore.
4) Constructors:
define as "new" method
Type.new(arg: Int) { this.field = arg }use with "new" keyword
var t = new Type(0)Constructors were added for all standard types, so you may use
new List()
etc...
5) Operator overloading:
a + b => a.add(b) a - b => a.sub(b) a * b => a.mul(b) a / b => a.div(b) a % b => a.mod(b) a << b => a.shl(b) a >> b => a.shr(b) a>>>b => a.ushr(b) a & b => a.and(b) a | b => a.or(b) a ^ b => a.xor(b) -a => a.minus() !a => a.not() a == b => a.eq(b) a != b => !a.eq(b) a < b => a.cmp(b) < 0 a <= b => a.cmp(b) <= 0 a > b => a.cmp(b) > 0 a >= b => a.cmp(b) >= 0See working example with complex numbers [2].
6) Global variables and structure fields can now be initialized right in place.
type Person { name: String = "Joe", age: Int = 20 }
7) Function arguments now support default values
Declaration:
def test(a: Int, b: Int = 0);Now can be used with one or two arguments:
test(1,1) test(3) // == test(3, 0)
8) Cast can be used with more convenient syntax, like method
(3.0 / 2.0).cast(Int)
CORE LIBRARY IMPROVEMENTS
New string methods:String.startswith(prefix): Bool String.endswith(suffix): Bool String.replace(oldchar, newchar): StringNew I/O methods:
IStream.readfully() // returns [Byte] array IStream.reset() // rewinds input to the beginning of fileNew system methods:
sys_property() // returns named system property
UI LIBRARY IMPROVEMENTS
1) form now generates EV_ITEMSTATE events when contents of any item changes. This can be useful for interactive forms.2) Menu types, as requested by several users. Menu type is passed in constructor as optional argument, e.g.
var yes = new Menu("Yes", 1, MT_OK)[1] http://code.google.com/p/alchemy-os/downloads/list
[2] http://e.alchemy-os.googlecode.com/git/examples/3-complex/ comments powered by Disqus