[taos-glug] object-oriented Guile/Scheme
- From: Philip Ansteth <pansteth@xxxxxxxxxxx>
- To: taos-glug@xxxxxxxxxxxxx
- Date: Fri, 4 Jul 2003 00:59:12 -0600
One thing that has worried me a little about Scheme is
that it might be out-of-date with respect to so-called
"object-oriented" programming. There seem to be libraries
that facilitate that style of programming, but I hadn't found
anything simple in the tutorials I'd looked at.
But tonight I did find something in the "guile-tutorial."
(I don't know exactly where this tutorial came from, but somehow it
got installed on my Debian Gnu/Linux system, and I access it
with "info guile-tutorial". There's a slightly different
version at http://www.ugcs.caltech.edu/info/guile/guile-tut_toc.html
The section I found interesting is under "A bunch of operations
in Scheme." It's the function MAKE-CELL.
(The author, by the way, is somebody named Mark Galassi who apparently
works at the Los Alamos labs.)
I don't understand all of MAKE-CELL, but I tried the same techniques
with a simple OO example from another book, and they worked.
In OO jargon (as I understand it), what Galassi provides is a
straightforward way to define classes and instantiate objects. His examples
don't show any way to do inheritance, but they can be used for
object composition. (Object composition may be preferable to class
inheritance anyway, according to the "Design Patterns" book. Page 20, if
you want to look it up.)
So I'm pretty confident that anybody who yearns to do object-oriented designs
can find good ways to implement them in Scheme.
Other related posts:
- » [taos-glug] object-oriented Guile/Scheme