Nested defines

From: Gerald Klix <gklix_at_fred.hassler.net>
Date: Sun, 10 Nov 1996 17:38:19 +0100

Hello,
I encountered a problem with local defines in STk:
Code like the following crashes STK (on Linux) or produces wrong
results:

(let ((xxx 52)) (define tv0 (begin (define tv1 1) 2)) (list xxx tv0
tv1))

I know that this is not conforming to any standard.
The STklos implementation uses similar code, but the define epressions
are nested in eval clauses
evaluating them in the global environment.
I would like to make define clauses like this work, in order to
implement
an environment based module system. To make the module system work I
must change
the STklos implementation to define classes and generics in the local
environment.

I looked into syntax.c function STk_syntax_define and wondered whether
it is reentrant when working on the same environment.
>From the code in this function I deduced
that an environment is represented as as list of variable symbols
and a list of variable values. These lists are consed togther.
After some thinking I found out, that it should throw away the
inner variable binding, tv1 in the example, but it should not
crash STk by creating circular lists or the like.

Has anyone any idea to slove this problem.

Gerald Klix
Received on Sun Nov 10 1996 - 17:37:12 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST