Path: news.daimi.aau.dk!news.uni-c.dk!sunic!trane.uninett.no!eunet.no!nuug!EU.net!uunet!zib-berlin.de!news.belwue.de!news.uni-ulm.de!rz.uni-karlsruhe.de!ma2s3!haible From: haible@ma2s2.mathematik.uni-karlsruhe.de (Bruno Haible) Newsgroups: comp.lang.beta,comp.lang.lisp Subject: Comparison: Beta - Lisp Date: 8 Sep 1994 13:15:58 GMT Organization: University of Karlsruhe, Germany Lines: 114 Message-ID: <34n2qe$d74@nz12.rz.uni-karlsruhe.de> NNTP-Posting-Host: ma2s3.mathematik.uni-karlsruhe.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Keywords: beta, lisp Originator: haible@ma2s3 Xref: news.daimi.aau.dk comp.lang.beta:4 comp.lang.lisp:13129 Since a new language called BETA is gaining attention, which has some features Lisp is proud of, I attempt a comparison between Beta and Lisp. Since there is currently only one implementation of Beta, the Mjolner system, I add a rough evaluation of it. Comparison Lisp <--> Beta A. The BETA language 1. Has an incredible symmetry between data and executable program code. Much better than Lisp. Syntax is such that execution goes strictly from left to right, except for loops. 2. Lexically scoped, but a module system ("fragment" system) permits to put parts of a program into separate files - effectively splitting interface and implementation. 3. Multiple values, but symmetrically for both input (function arguments) and output (function return values). A program can be viewed as moving data around between black boxes. 4. PROGN, LET, Lisp closures, list objects, defstruct objects, CLOS instances all correspond to "pattern"s. 5. Symmetry data/code provides automatically for different kinds of inheritance: outer level inner level ----------- ----------- code code local function definitions data code local variables code data ?? data data defstruct :include 6. "Part objects" cover the issues - local functions with lexical scope, - defstruct :include, - defclass subclassing, but only single inheritance. 7. The ":<" token makes up - generic classes (not present in Lisp, you would have to use a DEFCLASS in a non-null lexical environment), - generic functions, - &key parameters for functions. 8. The "::<" token specifies - subclassing, - methods for generic functions, - keyword arguments for functions. 9. CALL-NEXT-METHOD goes the other way around: the most general method determines the general behaviour, the most specific method only plays the role of a fixup. 10. Compile-time typing where possible, run-time tying where necessary. For example, you can put functions into plain lists or into lists of functions. The latter saves some run-time checks. Of course, general lists and lists of functions share the same definitions for insert, delete etc. 11. Concurrency, i.e. deterministic parallelism. (Would make WITH-PACKAGE-ITERATOR and WITH-HASH-TABLE-ITERATOR obsolete in CL.) 12. No multiple inheritance. No generic functions with more than one dispatching argument. The macro system is pretty much limited, violates lexical scoping, therefore error prone to use. B. The Mjolner BETA implementation 1. It is as easy to generate machine code for Beta programs than for Lisp. 2. Generates standalone executables. Hello-world is just 100 KB on Linux. 3. Automatic garbage collection (generational, scavenging). 4. Speed: consing up 1000 closures into a list Mjolner 0.049 sec CLISP 0.064 sec GCL 0.168 sec some integer array hacking C 4.2 sec Mjolner 111 sec GCL 288 sec CLISP 415 sec (All timings on a 486/33.) 5. Libraries for all kinds of container classes, streams, processes, exceptions, X11, Motif. C. The grains of salt: 1. The syntax is orthogonal, but you have to get used to it. 2. Unhygienic macros ("super patterns"). 3. No nested comments. 4. Need a dictionary for the words "pattern", "part object", "virtual pattern". For more information about BETA, look into the comp.lang.beta newsgroup. Disclaimer: I have no relation with Mjolner Informatics, except that they gave me a copy of their Mjolner compiler for free. Bruno Haible haible@ma2s2.mathematik.uni-karlsruhe.de