This is the mail archive of the mailing list for the Kawa project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

problem with set!


when I replaced my old Kawa with the new Version, I found some funny 
behavior of the set!-command. It sets unbound variables. In the mail 
archive, I found a thread about that, where Per Bothner writes:

> Daniele Maraschi <> writes:
>> I found something not very conformed to Standard Scheme:
>> [daniele@einstein kawa]$ java kawa.repl
>> #|kawa:1|# (set! a 5)
>> #|kawa:2|# a
>> 5
>> #|kawa:3|# 
>This is totally conformant to Standard Scheme.  Please read the last
>paragraph of R5RS section 5.2.1 "Top level definitions".

I do not agree with that. Consider this:

#|kawa:1|# a
gnu.mapping.UnboundSymbol: Unbound symbol a
#|kawa:2|# (set! a 5)
#|kawa:3|# a

with respect to the last paragraph of 5.2.1, kawa should either issue 
another error for the set!-command or no error at all, i.e. a is 
bound from the begining.

My question now is: is there an esay way to get back to the behavior 
of the old kawa in this case? I do not use elisp or commonlisp, just 

I found a commented line in where an 
UnboundSymbol-exception is thrown:

	if (bind != null)
	  env.put (name, new_val);
	  env.define (name, new_val);
	//	  throw new UnboundSymbol (name);

I changed the last two lines to

	//  env.define (name, new_val);
	  throw new UnboundSymbol (name);

This seems to work fine for top-level assignments, but does not help 
with set!-commands in the <body> of a lambda or so. What else has to 
be changed? I can't locate the point where this case is handled.

BTW: Is it possible to refer to the extended environment of a <body> 
from within that <body>, i.e. for example where

(lambda (x)
  ((this-env) 'x))

is the same as

(lambda (x) x)



Marcus Otto
Institute for Mathematics and Computer Science
Ludwigsburg Educational University
Reuteallee 46 - 71634 Ludwigsburg - Germany
phone: ++49 (0)7141/140-420

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]