Re: comments Marc Nieper-Wißkirchen 05 May 2020 06:21 UTC

Am Mo., 4. Mai 2020 um 23:21 Uhr schrieb Marc Feeley <xxxxxx@iro.umontreal.ca>:
>
> It should be specified that it is an error to call set-box! with a number of values that is different than the number of values in the box being set.  In other words, set-box! does not allocate memory.

I agree that this is a good idea and a reasonable restriction.

>
> Your extension to boxes reminds me of how multiple values are implemented in Gambit, with a “values object” which is in effect SRFI 195 boxes, in the sense that (box A B C) is Gambit’s (values A B C).  For that reason I would like your SRFI to specify that it is allowed, but not required, that
>
>        (box X ...)  is equivalent to  (values X ...)
>        (unbox b)    is equivalent to  b

This cannot work, can it? Boxes can be used to emulate the passing of
values by reference. Or is

(values x)

different from

x

in Gambit? This cannot be because "(values x)" has to evaluate to x, doesn't it?

A sentence like "(box X ...)" is allowed to be equivalent to "(values
X ...)" doesn't make sense in a general SRFI because the latter
evaluates, in general, to a number of values while the former is a
single value.