Re: either-guard reference implementation
Marc Nieper-Wißkirchen 16 Jul 2020 20:39 UTC
Am Do., 16. Juli 2020 um 20:14 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
> I think they should reject empty bodies. What's the point of going through all that binding and then just returning something useless.
If the and-let* body of SRFI 2 is empty, the value of the form is the
value of the last claw, which makes perfect sense.
This has an obvious generalization to SRFI 189's maybe-let*.
>
> On Thu, Jul 16, 2020 at 2:04 PM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz> wrote:
>>
>> On 2020-07-16 13:45 -0400, John Cowan wrote:
>> > > If this is what is expected, I think the SRFI
>> > > should indicate that "<body> is a sequence of zero or more definitions
>> > > followed by one or more expressions".
>> >
>> > My point is that people familiar with Scheme specifications will already
>> > know that. It's not actually defined in one place in R[57]RS, but it
>> > appears repeatedly in the definitions of let, let*, etc. So I think people
>> > will not be surprised if either-guard fails because they have not provided
>> > at least one expression.
>>
>> I had the very same thought. Then the sample implementation of
>> either-guard behaves as expected.
>>
>> On the other hand, the -let*(-values) forms accept empty bodies
>> (as an artifact of their origin in SRFI 2); in this case, they return
>> a Just / Right of an unspecified value. If it seems important enough,
>> I'll change the implementation of these forms to reject empty bodies.
>>
>> --
>> Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
>>
>> "The composer makes plans, music laughs." --Morton Feldman