ANN: Dao Language v.0.9.6-beta is release!

phoolimin at gmail.com phoolimin at gmail.com
Thu Dec 1 06:26:36 EST 2005


The best way to compare Dao with Python in detail would be, join a SF
project PLEAC, and provide solutions in Dao to those common programming
problems listed in Perl Cookbook(by Tom Christiansen & Nathan
Torkington, published by O'Reilly). The solutions in Python is there,
when solutions in Dao would be available, one can quickly compare it
with other languages using PLEAC project. But unfortunately, I don't
have enough time to it. So I will spend some time to grab some examples
from python tutorials, and show how they can be done in Dao, but you
have to wait for some days :-)

For the second question, I will list some. First I should admit I don't
know well python, so maybe there are convenient solutions for something
that I think not convenient in python.

1. Multi-threaded programming:

In Dao, for any function or expression, one can evaluate them in an
independent thread as: thread.create( myfunc() ); or thread.create(
myexprs );

In python, probably one have to subclass from a thread class, and
reimplement a method (something like run(), if I remember correctly),
and then call that method.

In Dao, one can create and access thread specific data through a
hash/dictionary data structure thread.my["data_key"], which is thread
global. In python, I don't know how to do it yet.

2. Numeric array:
Dao have built-in numeric array type, one can create a numeric array in
the following ways:
array1 = [ 1, 2, 3 ]; # {1,2,3} will create a normal array
array2 = [ 0: 2 :4 ]; # create [0,2,4,6]
array3 = [5] : 1; # [1,1,1,1,1]
array4 = [3] : [1,2]; # [[1,2],[1,2],[1,2]]
...
one can use normal operators +,-,*,/,++,--, +=,-=,etc. to operate on
numeric array and scale number, or two numeric array of the same size,
or two numeric array with different size but constraint the operations
on specific elements by subindex. There are also other features make
operations on numeric array convenient.

I am sure python can do them, but I wonder if they are convenient.

3.Transient variable and "magic" functions:
Dao provides so called features such transient variable (composed of @
and digits) and "magic" functions, which are provided as a kind of
functionaly programming tools, and in particular, transient variable
provides an explicit control during implicit parameter passing in such
"magic" functions. I think this is not something available in python.

As exmaples:
sort( array, @1<@2 ); Or: sort( array, exprs( @1, @2 ) );
where @1 represents the first of the two elements for comparison during
sorting, and @2 represents the second. It will sort array so that any
two neighbors elements satisfy (if possible) the second expression in
sort().

iterate( array, exprs( @1 ) ); will iterate on array and execute the
expressions after the first parameter. Here @1 represents each element
of the array. This function can be nested, in this case one may use @1,
@2, @3 ...

These two features are even more useful in numeric array operations, I
will not show example here. If you want to find it out, please have a
look at the documentation for Dao.

4. Extending using C++:
To extend Dao, one must use C++ (at least as an intermediate
interface). However, the C++ to extend Dao is very simple, and
transparent. And one only need two header files to build a Dao plugin
WITHOUT linking to Dao library! I believe the extending of Dao using
C++ is much simpler and more convenient than python.

That's enough. If I say something wrong about python, please point out.

Limin




More information about the Python-list mailing list