[Ecls-list] turn off auto declares

Dean O'Connor dean.oconnor at ite.com.au
Mon Nov 21 06:59:06 UTC 2005


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.

So if when I ran the scripts (not compiled), if a "setq" failed because 
the symbol  is not bound to anything then I would know i've missed 
declaring/binding a variable in LET or whatever.

Is there a way to force it so that setq/f will fail if the variables is 
not yet bound to anything ... or am I losing the plot here ?????

Eg:

(defparmeter y 2)

(defun test1 () (setq x 1))    --> I would like it to fail, since x is 
not bound

(defun test2 () (setq y 2))  ---> this should work, cause y is bound already

Cheers
Dean

Juan Jose Garcia Ripoll wrote:

>On Mon, 2005-11-21 at 15:15 +0100, Juan Jose Garcia Ripoll wrote:
>  
>
>>I do not see this work on my copy of CMUCL (19a-release-20 from
>>Debian) :-/ See below that the behavior of the compiler is independent
>>of the variable they mention: it always signals an error on undefined
>>variables, much like ECL. Hence, ext:*top-level-auto-declare* only
>>controls how interpreted forms behave, and even then it is only a
>>warning, not an error.
>>
>>Is this what you meant?
>>
>>Juanjo
>>    
>>
>
>The following statement was run on one CMUCL session:
>
>  
>
>>* (setq s 1)
>>Warning:  Declaring S special.
>>
>>1
>>    
>>
>
>The following ones in a different one:
>
>  
>
>>* (setq ext:*top-level-auto-declare* nil)
>>
>>NIL
>>* (compile 'foo '(lambda () (setq s 1)))
>>; Compiling LAMBDA NIL:
>>; Compiling Top-Level Form:
>>
>>; In: LAMBDA NIL
>>
>>;   (SETQ S 1)
>>; Warning: Undefined variable S
>>; ;
>>
>>; Warning: This variable is undefined:
>>;   S
>>;
>>
>>; Compilation unit finished.
>>;   2 warnings
>>
>>
>>FOO
>>NIL
>>NIL
>>* (foo)
>>
>>1
>>    
>>
>
>As for the lisp image:
>
>CMU Common Lisp CVS release-19a 19a-release-20040728 + minimal debian patches, running on mpq3p32
>With core: /usr/lib/cmucl/lisp.core
>Dumped on: Fri, 2005-10-14 11:44:34+02:00 on mpq3p32
>For support see http://www.cons.org/cmucl/support.html Send bug reports
>to the debian BTS.
>or to pvaneynd at debian.org
>type (help) for help, (quit) to exit, and (demo) to see the demos
>
>Loaded subsystems:
>    Python 1.1, target Intel x86
>    CLOS based on Gerd's PCL 2004/04/14 03:32:47
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
>Register for a JBoss Training Course.  Free Certification Exam
>for All Training Attendees Through End of 2005. For more info visit:
>http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
>_______________________________________________
>Ecls-list mailing list
>Ecls-list at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/ecls-list
>  
>





More information about the ecl-devel mailing list