From: ········@gmail.com
Subject: Changing non-special variable to special affects closures
Date: 
Message-ID: <7d1e6937-92e9-4a44-9312-556aae87b8c5@x29g2000prf.googlegroups.com>
;; SBCL:
(let ((v1 "closure"))
	   (defun f1 () v1))
(f1) ; -> "closure"

(defparameter v1 "special")
v1 ; -> "special"

(f1) ; -> "closure"
;; OK this is what I was expecting

;; NOW CLISP
(let ((v1 "closure"))
	   (defun f1 () v1))
(f1) ; -> "closure"

(defparameter v1 "special")
v1 ; -> "special"

(f1) ; -> "special"
;; WHY???

;;Thank you

From: Tobias C. Rittweiler
Subject: Re: Changing non-special variable to special affects closures
Date: 
Message-ID: <87prg4tvo1.fsf@freebits.de>
········@gmail.com writes:

> ;; SBCL:
> (let ((v1 "closure"))
> 	   (defun f1 () v1))
> (f1) ; -> "closure"
>
> (defparameter v1 "special")
> v1 ; -> "special"
>
> (f1) ; -> "closure"
> ;; OK this is what I was expecting
>
> ;; NOW CLISP
> (let ((v1 "closure"))
> 	   (defun f1 () v1))
> (f1) ; -> "closure"
>
> (defparameter v1 "special")
> v1 ; -> "special"
>
> (f1) ; -> "special"
> ;; WHY???

You do not compile F1, so in your call of F1 its definition is
interpreted in a context where V1 is special.

I haven't looked up whether the standard mandates anything about this,
or leaves this undefined. If the latter, it's a cute example of the
difference between interpreted and compiled code.

  -T. 
From: Marco Antoniotti
Subject: Re: Changing non-special variable to special affects closures
Date: 
Message-ID: <195dcd62-0d1b-48f5-a910-7346a8fe9795@o36g2000yqh.googlegroups.com>
On Mar 26, 11:39 am, "Tobias C. Rittweiler" <····@freebits.de.invalid>
wrote:
> ········@gmail.com writes:
> > ;; SBCL:
> > (let ((v1 "closure"))
> >       (defun f1 () v1))
> > (f1) ; -> "closure"
>
> > (defparameter v1 "special")
> > v1 ; -> "special"
>
> > (f1) ; -> "closure"
> > ;; OK this is what I was expecting
>
> > ;; NOW CLISP
> > (let ((v1 "closure"))
> >       (defun f1 () v1))
> > (f1) ; -> "closure"
>
> > (defparameter v1 "special")
> > v1 ; -> "special"
>
> > (f1) ; -> "special"
> > ;; WHY???
>
> You do not compile F1, so in your call of F1 its definition is
> interpreted in a context where V1 is special.
>
> I haven't looked up whether the standard mandates anything about this,
> or leaves this undefined. If the latter, it's a cute example of the
> difference between interpreted and compiled code.

I don't remember the wording or the section, but ITIR that the spec
mandates no differences between "interpreted" and "compiled" code
(modulo the various read, macroexpand, compilation and run times).

Cheers
--
Marco