Dao is a lightweight and optionally typed programming language
with many advanced features. It includes features that can make
concurrent programming very simple. It provides well designed
programming interfaces for easy embedding and extending.
Try Dao in browser!
Main features:
Some preliminary comparisons to other languages can be found at help:misc.comparison . Some preliminary benchmark results can be found at help:misc.benchmarks . Here are some simple examples to provide a preliminary demonstration of the language: # Type alias for a tuple type: type Address = tuple<number:int,street:string> # Function with explicit parameter types: routine Rout( name: string, index = 123 ) => int { io.writeln( name, index ) return 123 } Rout( 'abc' ) class InheritanceBase { var address : Address = ( 123, 'Main St' ) } class MixinBase { var name = 'Joe' } # Derive a new class that contains MixinBase # and inherits InheritanceBase: class Klass ( MixinBase ) : InheritanceBase { static state : enum<off,on> = $off } someone = Klass() # Closure (access to outer variables): closure = routine( x ){ io.writeln( x ) } for( i = 1 : 5 ) defer { closure( i ) } routine Producer( chan: mt::channel<int> ) { for( index = 1 : 10 ) chan.send( index ) chan.cap(0) } routine Consumer( chan: mt::channel<int> ) { while(1){ data = chan.receive() if( data.status == $finished ) break } } chan = mt::channel<int>(2) Producer( chan ) !! # Start the producer tasklet; Consumer( chan ) !! # Start the consumer tasklet; # Parallelized code section methods: mt::apply( [1.0:100], 4 ){[x] log(x) } |
Copyright (c) 2009-2016, Limin Fu |