chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] multiple values in chicken


From: Elf
Subject: Re: [Chicken-users] multiple values in chicken
Date: Tue, 5 Feb 2008 05:31:46 -0800 (PST)


there are no consing semantics.  when i said theyll be 'call with values' on
the inside, i meant that theyd have to do the same thing internally as call-with-values is currently doing, if they wanted to maintain continuation
safety.  theres no way to avoid it, and the current implementation is probably
as minimal as would be sane, without putting in a hell of a lot of thought.

-elf


On Fri, 1 Feb 2008, Tobia Conforto wrote:

From the other thread

Elf wrote:
John Cowan wrote:
It also occurs to me that rec and let-values and all need not expand into call-values--that's just the *portable* expansion of them.

they'll all be call-with-values on the inside, or the equivalent thereof.

Not necessarily.

I see what John is proposing here, and it makes sense to me.

We could choose values and receive (or let-values) to be the primitive calls and relegate call-with-values to the role of a somewhat inefficient wrapper, included for the sake of conformance.

- (values 1 2) could put the two values in registers or stack locations, without unnecessary consing, taking care to put the first returned value in the conventional register for single return values; - (receive (x y) ...) and the equivalent let-values form would just give names to those conventional registers or stack locations, without any destructuring; - other consuming forms could just use the first returned value and ignore the others, as they currently do; - (call-with-values) would be a bit more complex, because it would need to emulate all the calling and consing semantics, but I'd wager it's doable.

Sorry if I can't be more precise (and clever), but I don't know Chicken's internals very well (yet)

Making multiple return values as optimized as a single C call seems doable and very useful to me, even if it means optimizing for (receive) and (let-values) on the receiving side, instead of (call-with-values).

What do you think?


Tobia


_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]