#451 closed defect (fixed)
Unexpected warning using define-values at toplevel.
Reported by: | Alan Post | Owned by: | felix winkelmann |
---|---|---|---|
Priority: | minor | Milestone: | 4.9.0 |
Component: | compiler | Version: | 4.6.x |
Keywords: | Cc: | alanpost@… | |
Estimated difficulty: |
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'.
Change History (6)
comment:1 Changed 14 years ago by
Cc: | alanpost@… added |
---|
comment:2 follow-up: 3 Changed 14 years ago by
Owner: | set to felix winkelmann |
---|---|
Priority: | not urgent at all → minor |
Status: | new → assigned |
comment:3 follow-up: 4 Changed 14 years ago by
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?
comment:4 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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.
This is admittedly somewhat confusing. I will try to detect this case or remove the warning.