[Ecls-list] turn off auto declares

Juan Jose Garcia Ripoll lisp at arrakis.es
Wed Nov 23 03:09:10 UTC 2005


On Tue, 2005-11-22 at 01:58 +1100, Dean O'Connor wrote:
> Well errr ... I don't know really. I just found that CMUCL link and 
> thought it might be a clue for ECL.
> 
> Perhaps I am asking something silly .... but let me be more specific ...
> 
> I am converting old Emac Lisp scripts to work under ECL. These old 
> scripts used global variables everywhere. They just set them in 
> functions with a "setq".
> There are no LETs or even DEFVAR/PARAMETERS.
> I am trying to convert them to local (and some dynamic/special) 
> variables, but its difficult to be sure I don't miss any.

Latest change (in CVS):

 - A new global variable EXT:*ACTION-ON-UNDEFINED-VARIABLE* controls whether
   the interpreter complains when you try to assign a value to a symbol that
   has not been defined as variable. An example

	> (SETQ S 1)	; No complain
	1
	> (SETQ EXT:*ACTION-ON-UNDEFINED-VARIABLE* 'ERROR)
	ERROR
	> (SETQ X 1)	; Ooops, X had not been defined before!
	Undefined variable referenced in interpreted code.
	Name: X
	>> :q
	> (DEFVAR X 1)
	X
	> (SETQ X 1)
	1

I am not sure about the interaction between this code and code that
assumes global variables can be defined by SETQ. Notice however an
important difference between ECL and CMUCL:

	In standard ECL, doing (SETQ X 1) on a previously
	undefined variable X does not make X special!!!!

In otherwords, (SETQ X 1) assigns a value to the symbol X but is not
equivalent to (DEFPARAMETER X 1).

Regards

Juanjo





More information about the ecl-devel mailing list