[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Lua and Dylan
- From: "Michael T. Richter" <mtr@...>
- Date: Thu, 20 Apr 2000 10:07:01 -0400
> [ By the way, on a seperate note, and you may know. Is Dylan similar
> to Lua? I think that has language extension features. How does Lua
> compare? ]
Well, my favorite language for development is Dylan and Lua is one of two
favorites (Python is the other) for scripting. I think I can help you out a
bit here. :-)
Dylan and Lua are in different domains as languages. There's some thematic
similarity, but not a lot.
Dylan is an impure, non-lazy functional programming language at its core.
It supplements this functional core with a hygenic macro system that permits
it to emulate other programming styles. There is a stock set of such macros
in the language specification which permit it to support object-oriented
programming and procedural programming out-of-the-box. Looping constructs,
for example, are predefined macros. (Note that these predefined macros tend
to be implemented in the compiler itself, but their semantics and behaviour
can be defined by macros.)
As an example of the power of this approach, consider DUIM, the GUI library
for the Functional Developer implementation of Dylan. DUIM consists of a
whole bunch of classes and macros. The macros permit large, complex GUI
applications to be built in a concise declarative (as opposed to functional,
procedural or object-oriented) style. Anybody who has ever written a
Windows resource (.RC) file will recognize the approach and find it natural.
Dylan, in any of its current incarnations, isn't suitable as a scripting
language, however. It is oriented towards compilation, not interpretation.
To make Dylan a scripting language would require, in essense, inclusion of
the full compiler into the scripting executable. Dylan compilers are a bit
large for this, and they are a bit slow when they hit macro expansion
(macros "calls" can expand into macro calls which can expand into macro
calls and so on).
I suspect I don't have to introduce Lua to the members of this list. :-)
The thematic similarity that Dylan and Lua share is the use of a
meta-mechanism to extend the semantics of the language. Lua uses tags.
Dylan uses macros. Dylan's approach is much more flexible, but for that
much more expensive at compilation time. Lua's approach is simpler, faster
to interpret and occupies a whole lot less space.
I've currently got Lua built as a pair of Win32 DLLs with the C API
functions exposed and am working on moving the API into Dylan's C-FFI (C
Foreign Function Interface) library. When I'm finished with the process
(currently somewhat stalled), I'll be able to write software in my favorite
development language and to plug in my favorite extension language on the
side. I'm happy! :-)