[r6rs-discuss] "Unspecified"

From: Marcin 'Qrczak' Kowalczyk <qrczak>
Date: Mon Oct 2 15:28:10 2006

Per Bothner <per_at_bothner.com> writes:

>> [mutiple values] can't be fully first-class.
>> (call-with-values (lambda () x) (lambda (y) y))
>> This currently succeeds for any value of x, it doesn't even look
>> inside it.
>> This would stop working for x being the multiple-values value.
>
> If the variable x is bound to multiple values (zero or more than one),
> the this code would be erroneous. But this is "currently" not possible.
> So I don't understand your comment.

Because they are not first-class now; I claim that they wouldn't be
fully first-class with your modification either. Some code which
currently accepts any value, would accept any value except the
multiple-values value. You would introduce exceptions in cases which
currently have no exceptions.

If you want them to be first-class, just use a list instead.
What's wrong with a list?

>> How many values is (values (values 1 2 3) (values 4 5 6))?
>> What about (values (values 1 2 3))? Here lies madness.
>
> No, it is quite consistent (and useful).
>
> (values (values 1 2 3) (values 4 5 6)) == (values 1 2 3 4 5 6)
> (values (values 1 2 3)) == (values 1 2 3)

Then they are even less first-class. Currently if a function returns
(values x y), then its caller can retrieve x and y back. With your
modification this would no longer be possible, and we would need to
invent another way to return two arbitrary values. If we don't do it,
libraries would emerge which which work with any values except
multiple-values values.

BTW, what would be (list (values 1 2))?

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak_at_knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/
Received on Mon Oct 02 2006 - 15:28:00 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC