[Prev][Next][Index][Thread]

Re: Does my ideal language exist?



On 13 May 2000 12:07:16 +0200, Jean-Louis Leroy <jll@skynet.be> wrote:

> Does anybody know about a language that would have the following
> features:

How about Dylan? (http://www.fun-o.com) It's a modern Lisp-family language
designed from scratch to try and bring the benefits of Lisp to the masses:
infix syntax, OO throughout, straightforward application delivery etc.

>         - incremental compiler like Forth

Yup.

>         - strong typing, multiple inheritance and generics like C++

Dylan is still a dynamic language, but its more type-oriented than Common Lisp.

C++ MI is much hairier than in other languages by all accounts: e.g. multiple
'copies' of ancestor class slots if inherited via more than one path. Yuck.

What do you mean by generics?

>         - multimethods like CLOS

Yup.


>         - closures like LISP & Perl

Yup.

Here are some examples:

// Dylan #1

define method say-hello ()
  format-out( "Hello World!\n" );
end;

// Dylan #2

define method factorial ( n :: <integer> )
  if ( n > 0 )
    n * factorial( n - 1 );
  else
    1
  end;
end;

// Dylan #3

define abstract class <event> ( <object> )
end class;

define abstract class <window> ( <object> )
end class;

define class <text-event> ( <event> )
  slot event-text :: <string>;
end class;

define class <text-window> ( <window> )
  slot window-stream :: <stream>;
end class;

define method handle ( w :: <window>, e :: <event> )
  error( "%= could not handle %=", w, e );
end method;

define method handle ( w :: <text-window>, e :: <text-event> )
  format( window-stream( w ), event-text( e ) );
end method;

__Jason