Re: [Scheme-reports] [scheme-reports-wg1] Re: Proposed compromise on #68 "unspecified value(s)"
Per Bothner 08 Sep 2011 18:18 UTC
On 09/07/2011 01:53 PM, John Cowan wrote:
> Per Bothner scripsit:
>
>> How should zero or multiple values be handled in a single-value
>> context such as function arguments? I.e. what is the best behavior
>> of: (list (values 3 4) 10) I see 3 plausible options:
>>
>> (B) Multiple values are "spliced" in the argument list, thus (list
>> (values 3 4) 10) is the same as (list 3 4 10). I've long been
>> attracted to this functionality, but I'm now concerned that it may be
>> both too error-prone (too easy to write hard-to-catch bugs) as well
>> has being difficult to optimize, I'm now thinking an explicit splicing
>> operator (possibly @ for consistency with quasi-quoting) is probably
>> better.
> No Scheme uses option B. In addition to the objections you raise,
> there is the fact that if cons is known to be bound to the usual value,
> "(cons (x))" can be rejected by a compiler under options A and C, but
> might be valid under option B.
An example of my concern that (B) makes it easier to
write certain bugs and harder for the compiler to catch them.
>> I just checked in a fix to [allow list/vector/string as the producer
function of call-with-values] (though I
>> can't imagine anyone wanting that ...).
>
> If you are invoking a library procedure that returns multiple values,
> you can get them as a list with (call-with-values (lib-proc) list).
> I do this routinely in test code.
That's using list as the consumer - is there any use case for using
list/vector/string as the *producer*?
--
--Per Bothner
per@bothner.com http://per.bothner.com/
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports