[Ecls-list] Bug report (?) and two questions
worm
worm at arrakis.es
Tue Nov 27 15:40:02 UTC 2001
> I'm new to this list and I'd like to start with thanking Juan Jose
> Garcia Ripoll and everyone else who currently works on ECLS for this
> very interesting project! Only recently did I (re-)discover Lisp and
> I'm glad I did - what a great programming language! And, although
> CMUCL, CLISP, or the commercial implementations might be more mature
> and complete, ECLS at the moment seems more interesting to me because
> it seems to be designed for playing around with it, plus - in this
> early stage - it already comes with a very promising documentation of
> its internals. Thanks again!
Hi,
thanks for your support. Most of the ecls User's Guide is due to Prof.
Attardi, who worked hard to document the internals of ECoLisp. Since
then lots of things have changed, and some may be improperly
documented. That is my fault, but it is hopefully concentrated on the
Programmer's Guide.
> I'd love to help with this project but I don't know if I could be of
> any use. As I said, I'm rather new to Lisp - I earned my money with
> things like Perl, PHP, C, and Java in the last years. I also know next
> to nil about Lisp implementations, so I don't think that at the moment
> I could by any help in the development of ECLS. If there are other
> things that could be useful - testing, documentation, whatever -
> please let me know and I'll see what I can do.
For the moment there is a sort of urgent task which is to define an
interface for embedding ECLS as a library. Said with other words, there
is the need to define a set of constructors and accessors so that
people programming with C/C++ can create and manipulate all lisp
objects easily.
> I don't know if this list is the right place for that, but I have two
> questions and a bug report - kind of:
This is the best place for bug reports.
> 1. If I define the factorial function in the usual, recursive way,[1]
> and call it (without compiling it) with an argument of 10000, this
> will result in a reproducible complete crash of my system. After
> about two or three seconds, the machine is completely unresponsive
> to the mouse or the keyboard and the only 'fix' is to power it down
> and hose the file system. This is Linux 2.4.10 (SuSE 7.3) on an IBM
> Thinkpad with 256 MB RAM and a 850 MHz P III.
This is due to the fact that the interpreted implementation is not tail
recursive. If you compile this code, the recursive call will be
converted to a C goto. If you simply interpret it, the stack will be
filled 10000 times and you will produce over 10000 bignums, which can
be rather memory intensive in case of a factorial. I will look into
this, though, to make sure that no other bug is popping out.
> 2. If you're building a stand-alone executable, is there a way to get
> at the command line arguments? I haven't found this mentioned in
> the documentation.
Not a documented one, but you can use (ARGC) and (ARGV number) to
access the arguments of the int main() routine.
> 3. If you mix Lisp with your own C code and you're accessing Lisp
> objects from C, what will happen if garbage collection occurs? Are
> there any guarantees or ways to prevent objects from being gc'd?
You will be safe if either keep your lisp object on a C automatic
variable (i.e. a variable on the stack) which is of "volatile" type. If
you keep a lisp object in a statically allocated variable (i. e. a C
extern or static variable) you should advice the garbage collector with
a call to register_root(cl_object *address_of_variable).
Best regards
Juanjo
More information about the ecl-devel
mailing list