[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] multiple values module

About a minute ago, John Cowan wrote:
> Eli Barzilay scripsit:
> > If you're talking about such things as
> > 
> >   (define-values (getter setter)
> >     (let ([state #f])
> >       (values ...blah1...
> >               ...blah2...)))
> I'm not only not talking about such a thing, I don't even understand
> it.

It is a very common reason for having multiple values.

> What I meant was this: trivially any procedure that returns
> multiple values could as well return a single value which is an
> aggregate of some sort such as a list or general vector.  However,
> it costs something to aggregate and disaggregate this value, a cost
> which *some* implementations of multiple values need not pay.

You can't avoid the extra cost.  Implementations vary with heap or
stack allocation which is something that goes in a different level.
In any case, your original statement of multiple values as some
lightweight alternative is even more wrong given this.  (The
historical context is first class continuations.)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Scheme-reports mailing list