Maybe macros John Cowan (26 Jun 2020 17:16 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (26 Jun 2020 17:43 UTC)
Re: Maybe macros John Cowan (26 Jun 2020 18:48 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (26 Jun 2020 18:57 UTC)
Re: Maybe macros John Cowan (27 Jun 2020 04:29 UTC)
Re: Maybe macros Arthur A. Gleckler (26 Jun 2020 19:50 UTC)
Re: Maybe macros John Cowan (26 Jun 2020 19:52 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (27 Jun 2020 03:44 UTC)
Re: Maybe macros Arthur A. Gleckler (27 Jun 2020 03:59 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (27 Jun 2020 04:15 UTC)
Re: Maybe macros Arthur A. Gleckler (27 Jun 2020 04:29 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (27 Jun 2020 14:09 UTC)
Re: Maybe macros John Cowan (27 Jun 2020 18:55 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (27 Jun 2020 20:46 UTC)
Re: Maybe macros John Cowan (27 Jun 2020 21:34 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (28 Jun 2020 17:26 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (28 Jun 2020 17:43 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (28 Jun 2020 18:52 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (28 Jun 2020 20:24 UTC)
Re: Maybe macros John Cowan (28 Jun 2020 18:54 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (28 Jun 2020 20:21 UTC)
Re: Maybe macros Alex Shinn (29 Jun 2020 00:02 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (29 Jun 2020 06:23 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (28 Jun 2020 16:54 UTC)

Re: Maybe macros Marc Nieper-Wißkirchen 28 Jun 2020 20:24 UTC

Am So., 28. Juni 2020 um 20:52 Uhr schrieb Wolfgang Corcoran-Mathe
<xxxxxx@sigwinch.xyz>:
>
> On 2020-06-28 19:43 +0200, Marc Nieper-Wißkirchen wrote:
> > If the values of the Maybe/Either returned by the empty `...-and' or
> > `...-or' forms are accessed to be processed further, the code is most
> > likely doing something very wrong. Zero values actually help here to
> > catch such logical errors because they will more likely raise an
> > error.
> >
> > [snip]
> >
> > If you want to leave the payload unspecified, you should also leave
> > the number of unspecified values unspecified. That certainly makes
> > sense.
>
> Agreed that the code is certainly doing something wrong.  However,
> the protocol of returning no values in case no meaningful value can be
> returned doesn't seem to be used much in Scheme, as yet.  But we might
> want to allow that to be an option, so I agree--leaving the payload
> completely unspecified is probably the right thing here.

+1

> > The best unit would be a Just/Left/Right for which it would be an
> > error to unwrap it. This could be some singleton value.
>
> I like this, although I suspect that few implementations would bother
> to signal this error; it would be necessary, I think, to add special
> "forbidden" Justs/Lefts/Rights for this purpose, and to check for them
> when unwrapping containers.  That seems a bit messy.

It is enough if the spec included three unique constant
Just/Left/Right values, for which "it is an error" to access their
payload. It is then up to the implementation whether it wants to
signal this error. For the reference/sample implementation,

(define the-just (just))

would be enough. It wouldn't signal an error, though.