( @(user) ) Login/Signup Logout
The Dao Programming Language
for Scripting and Computing

Dao is a lightweight and optionally typed programming language with many advanced features. It includes features that can make concurrent programming much simpler. It has well designed programming interfaces for easy embedding and extending.

routine Sum( nums :list<int> )
{
    sum = 0 
    for (x in nums) sum += x
    return sum 
}
ints = {1 : 2 : 1000}
fut = Sum( ints ) !!
sum = fut.value()
Home Documentation Download Blog Forum Projects Demo
Latest News

Change picture:

Choose file:
Try Dao in browser!

Main features: Please see help:dao.feature for a more complete list of summarized features. You might also be interested to check out the slides (pdf) presenting Dao on the Emerging Languages Camp (StrangeLoop 2013).

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 is an simple example to provide a glimpse of various aspects 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) }

view count 156615 times
created at 2009-02-19, 17:46 GMT
modified at 2014-08-09, 08:29 GMT
Visitor Map This site is powered by Dao
Copyright (C) 2009-2013, daovm.net.
Webmaster: admin at daovm dot net