[possible bug] Compiling a function in null lexical environment

4 messages Options
Embed this post
Permalink
Alessio Stalla

[possible bug] Compiling a function in null lexical environment

Reply Threaded More More options
Print post
Permalink
This is on ABCL (0.0.11) (+ scripting branch, but it should not matter):

(defun f (x) (compile nil (lambda () 42)))
(f 3)

; UNSUPPORTED FEATURE: COMPILE-DEFUN: unable to compile LAMBDA form
defined in non-null lexical environment.
; Unable to compile top-level form.
; Unable to compile function NIL defined in non-null lexical environment.

...this is probably not optimal, since the environment is not used by
the lambda (no variable is captured), but I can live with that.
However,

(defun f (x) (eval '(compile nil (lambda () 42))))
(f 3)

produces the same warning... but: isn't eval supposed to evaluate code
in a null lexical enviroment?

Alessio

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
armedbear-j-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel
Alessio Stalla

Re: [possible bug] Compiling a function in null lexical environment

Reply Threaded More More options
Print post
Permalink
Never mind, my mistake. Evidently it's time to go to bed ;)

A.

On Fri, Jan 16, 2009 at 12:19 AM, Alessio Stalla
<[hidden email]> wrote:

> This is on ABCL (0.0.11) (+ scripting branch, but it should not matter):
>
> (defun f (x) (compile nil (lambda () 42)))
> (f 3)
>
> ; UNSUPPORTED FEATURE: COMPILE-DEFUN: unable to compile LAMBDA form
> defined in non-null lexical environment.
> ; Unable to compile top-level form.
> ; Unable to compile function NIL defined in non-null lexical environment.
>
> ...this is probably not optimal, since the environment is not used by
> the lambda (no variable is captured), but I can live with that.
> However,
>
> (defun f (x) (eval '(compile nil (lambda () 42))))
> (f 3)
>
> produces the same warning... but: isn't eval supposed to evaluate code
> in a null lexical enviroment?
>
> Alessio
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
armedbear-j-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel
Alessio Stalla

Re: [possible bug] Compiling a function in null lexical environment

Reply Threaded More More options
Print post
Permalink
...but this is definitely true:

CL-USER(1): (let (x) (defmacro m () 42))
; Unable to compile function NIL defined in non-null lexical environment.
M
CL-USER(2): (m)
42


too tired to decide whether it's right or not...

A.

On Fri, Jan 16, 2009 at 12:39 AM, Alessio Stalla
<[hidden email]> wrote:

> Never mind, my mistake. Evidently it's time to go to bed ;)
>
> A.
>
> On Fri, Jan 16, 2009 at 12:19 AM, Alessio Stalla
> <[hidden email]> wrote:
>> This is on ABCL (0.0.11) (+ scripting branch, but it should not matter):
>>
>> (defun f (x) (compile nil (lambda () 42)))
>> (f 3)
>>
>> ; UNSUPPORTED FEATURE: COMPILE-DEFUN: unable to compile LAMBDA form
>> defined in non-null lexical environment.
>> ; Unable to compile top-level form.
>> ; Unable to compile function NIL defined in non-null lexical environment.
>>
>> ...this is probably not optimal, since the environment is not used by
>> the lambda (no variable is captured), but I can live with that.
>> However,
>>
>> (defun f (x) (eval '(compile nil (lambda () 42))))
>> (f 3)
>>
>> produces the same warning... but: isn't eval supposed to evaluate code
>> in a null lexical enviroment?
>>
>> Alessio
>>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
armedbear-j-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel
Erik Huelsmann

Re: [possible bug] Compiling a function in null lexical environment

Reply Threaded More More options
Print post
Permalink
On Fri, Jan 16, 2009 at 1:46 AM, Alessio Stalla <[hidden email]> wrote:

> ...but this is definitely true:
>
> CL-USER(1): (let (x) (defmacro m () 42))
> ; Unable to compile function NIL defined in non-null lexical environment.
> M
> CL-USER(2): (m)
> 42
>
>
> too tired to decide whether it's right or not...

Well, according to the spec, it's allowed to do this, however: It'd be
extremely cool to be able to do:

(let (x)
  (defun foo1 () x)
  (defun foo2 (y) (setf x y)))

(compile 'foo1)

I'm working on getting that in place.


Regards,


Erik.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
armedbear-j-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel