Hi,
You can't disable it. The value returned is the one returned by (##set-box! local-var's-box val) which currently returns local-var's-box.
Note that (set! local-var val) does not allocate a new box, it just returns the one that is associated with the local-var.
Is the issue that you didn't expect this or that you think it uses up resources?
In compiled code, the box object *is* necessary due to the use of assignment conversion for the correct implementation of closures.
I think you dislike that (set! local-var val) returns the box object associated with the local-var, but I am not sure why?
Note that in Scheme the value returned by (set! var val) is unspecified, so Gambit's behaviour conforms to the spec.
> It would be great to have this feature as a separate primitive instead, like box-var or var->box or sth, that'd work for both in interpreted and compiled code, and both for local and global vars. If there's anything like this, please let me/the ml know.The interpreter uses another representation for local variables. They are part of a frame which is represented with a vector.
Marc