Summary

Unexpected warning using define-values at toplevel.

Metadata

Description

The following program:

 (define-values (foo bar)
   (values
     (lambda () 0)
     (lambda () 1)))

When compiled with 'csc -d2 -o define-values define-values.scm'

Gives the following warning:

 
 Note: local assignment to unused variable `foo' may be unintended
 
 Note: local assignment to unused variable `bar' may be unintended

I would expect to get no warning in this case, and instead have two top-level definitions, 'foo' and 'bar' after calling define-values.

This warning only happens with '-d2'.

Changes and comments

[2010-12-11 18:26:34 UTC] alanpost set cc to alanpost@sunflowerriver.org

[2010-12-16 18:08:06 UTC] felix changed priority from not urgent at all to minor

[2010-12-16 18:08:06 UTC] felix changed status from new to assigned

[2010-12-16 18:08:06 UTC] felix set owner to felix

[2010-12-16 18:08:06 UTC] felix wrote:

This is admittedly somewhat confusing. I will try to detect this case or remove the warning.

[2010-12-16 18:18:43 UTC] alanpost wrote:

Replying to felix: > This is admittedly somewhat confusing. I will try to detect this case or remove the warning.

Does this warning suggest I shouldn't be using '(declare (safe-globals))' or any other optimization where I assert I'm not changing the value of my top-level module bindings?

I understand what is happening behind the scenes to make define-values work. I use it several times in genturfa'i to share a lexical environment between two or more top-level definitions, and that means they aren't *really* top-level bindings as far as the environment is concerned.

I really only care about the details when they interact with the optimizer, however. Will you comment on that as it regards this warning an any (declare ...) flags I might be using?

[2010-12-18 12:21:43 UTC] felix changed status from assigned to closed

[2010-12-18 12:21:43 UTC] felix set resolution to fixed

[2010-12-18 12:21:43 UTC] felix wrote:

Replying to alanpost: > Replying to felix: > > This is admittedly somewhat confusing. I will try to detect this case or remove the warning. > > Does this warning suggest I shouldn't be using '(declare (safe-globals))' or any other optimization where I assert I'm not changing the value of my top-level module bindings? >

No, it has nothing to do with this.

> I really only care about the details when they interact with the optimizer, however. Will you comment on that as it regards this warning an any (declare ...) flags I might be using?

Nevermind the warning, I have removed it for this case.

[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0

[2011-06-01 09:00:41 UTC] felix wrote:

Milestone 4.7.0 deleted

[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0

[2012-09-24 21:47:48 UTC] felix wrote:

Milestone 4.8.0 deleted