archives

2nd Revision of "Thoughts about the Best Introductory Language"

I finally got my act together and updated my "Thoughts about the Best Introductory Language" essay, with many corrections, some clarifications and several other enhancements. See the previous discussion of it here.

The licence is still CC-by.

Resume using continuations

I am looking at a way to implement Resume in a CPS-based intermediate language. Resume allows to try again a calculation with a different value.

If I mark the resume value with ^retry I want to do:

1 + ^retry 8  (* 9 *)
retry 5       (* 6 *)

In CPS, 1 + 8 may look like:

lambda (k) (k (+ 1 8))

Then I will extract the continuation around "8" to save it in a "retry" variable:

lambda (k) ((lambda (n) (k (+ 1 n))) 8)
lambda (k) ((lambda (k') (k' 8)) (lambda (n) (k (+ 1 n))))
(* save continuation *)
lambda (k) ((lambda (k') (do ((set! retry k') (k' 8)))) (lambda (n) (k (+ 1 n))))

I could do the same transformation for an arbitrary nested variable. What I do not like is that I use a "global" variable retry which I set!, but the alternative is to pass it around as a function parameter-- not very convenient.

Is my reasoning correct? Is there a better way?

Dao 1.0 preview version is released

Hi,

This language has been introduced to this forum before in Dao, a new programming language, now I would like to bring to your attention the latest release of Dao (1.0-preview version). Dao is a simple yet powerful object-oriented programming language featured by, optional typing, BNF-like macro system, regular expression, multidimensional numeric array, asynchronous function call for concurrent programming etc.

Since the last beta release (2006 november), a number of new features have been added to the language with some significant improvements on the implementation. Here I will just list some of them:

1. Added a new typing system, so that the type of a variable can be either declared explicitly or inferred implicitly, and type checking is performed at compiling time when possible. More over the type information is used for function overloading and function specialization (with type-optimized VM instructions) according to parameter types. Some types can be compounded into new types, e.g., list, tuple...

2. A flexible macro-system that allows writting macro in a form close to BNF, and can be used to define new syntax;

3. Added Asynchronous Function Call (AFC) and Message Passing Interface (MPI) for further support for concurrent and distributed programming (still experimental);

4. Added a few new data types, in particular, among which, there is the new tuple type in which each of the items is typed independently, for example, if a tuple is consisted of an integer and a string, then the type of the tuple will be tuple; Moreover the items of a Dao tuple can have field names.

5. The internal data storage scheme is improved to reduce memory overheads for simple types.

6. Added special support for the main() function, so that the command line arguments are mapped to the function parameters, and are checked against the paremeter types of main().

7. Improved representation of C/C++ types, so that their inheritance relationships can be still valid in Dao, and they can be derived by Dao classes directly.

Moreover, this release has included a tool (tools/autobind.dao) which can do semi-automated wrapping of C/C++ libraries. In fact, many of the modules released this time are generated by this tool. Just to list the modules released this time:
DaoCamellia (image processing),
DaoCGI (CGI Web programming),
DaoCLoader (running time wrapping of C libraries, slightly similar to the ctype module of Python),
DaoDataModel (database handling, can be used to set up mappng between data tables and Dao class types),
DaoFastCGI (CGI Web programming),
DaoLapack (linear algebra library),
DaoMagick (image processing),
DaoMGL (math plotting),
DaoMySQL (database),
DaoOpenGL (3D graphics),
DaoSDL (multi-media),
DaoTCC (embedding C codes into Dao scripts),
DaoXML (handling XML documents and fetching web pages from web servers),
DaoZlib (compression),
DaoVTK (3D data and model visualization).

I believe this release has become suitable for some practical applications, and worth to be tried out. Then a formal release of the 1.0 version will be made available during this august or september. I would be very grateful, if anyone can give me some suggestions for improvement, and feature requests are of course also welcome. Thanks and

enjoy,

Limin

home page
sourceforge project
download