Hi,
for those interested, there is discussion at
http://ootbcomp.com/topic/metadata/#post-424
about the use-cases (if any) of multiple-value returns
in Common-Lisp, mentioning SBCL specifically...
> [David wrote:]
> “One interesting scenario that comes to mind is the
> SBCL compiler for Common Lisp. When calling a function
> in Lisp, it is unknown how many values it will return.
> In SBCL x86-64, a single valued return returns with
> carry clear. For multi-valued return, carry is set
> and the count of returned values is held in RCX
> (which is a scratch register otherwise).”
>
> [Ivan Godard replied:]
> For the Mill I’d guess you would simply return the count
> as a second result in all cases. Is the value returned
> (when more than one) a list, so the flag is really saying
> whether thre resulting list is a primitive of a collection?
>
> “While it’s probably a more general question than metadata,
> how would you address older values on the belt after a
> function call which returns a variable/unknown number
> of return values?”
>
> In general you cannot do so; you would have to run everything
> you wanted to save off to scratchpad, and even that wouldn’t
> work because you would have no way to know how many results
> you got if you wanted to save them.
>
> I confess my ignorance of Lisp implementations; how does
> the received of multiple results discover that happened,
> and what would it want to do with them when it does?
> I suspect that the Mill would handle this at a higher level,
> but I need to understand the use-case rather than the
> conventional implementation for that case.
BTW, implementation of closures is mentioned at
http://ootbcomp.com/topic/memory/#post-386
(although with reference to Haskell, C++, ...)
Have fun,
Andreas

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details