On 19-Jan-09, at 5:27 AM, David Rush wrote:
2009/1/19 Marc Feeley feeley@iro.umontreal.ca:
On 18-Jan-09, at 7:50 PM, David Rush wrote:
*** ERROR IN call-with-values -- (Argument 2) LIST expected (apply '#<procedure #2> '#<unknown>)
,be
0 call-with-values
There's something strange in this backtrace... the procedure call-with-values should never appear in the backtrace! It should be ##call-with-values... so
- Are you redefining call-with-values in your code?
Exactly right. I'd completely forgotten about it as it was part of an old Gambit 3.x compatibility package. My apologies for the waste of bandwidth.
david rush
[I'm CCing the Gambit list because this may be of general interest.]
Good to know the problem is solved!
As a general rule, if code works interpreted but not compiled, you should try compiling your code with no declarations. Then add the declarations one by one to see which one is causing the problem.
Remember that the validity of declarations is not checked by the system. The compiler will trust you blindly and if the conditions are not right the semantics of the compiled code will not match the semantics of Scheme.
It is perfectly valid to redefine the "call-with-values" and "values" procedures if you wish to, but if you do you cannot use the standard- bindings declaration for those procedures. In that case, the proper declaration to use in your code is:
(declare (standard-bindings) (not standard-bindings call-with-values values))
Moreover you should not use the block declaration when defining those procedures because there is more than one assignment to those variables (i.e. once in your code and once in the runtime system). So the procedures should be defined like this:
(declare (separate))
(define (values . lst) lst) (define (call-with-values producer receiver) (apply receiver producer))
(declare (block))
... rest of the code
So when it comes to declarations... you'll be sorry if you lie to the compiler!
Marc