Email list hosting service & mailing list manager

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 26 Jun 2020 18:57 UTC

Am Fr., 26. Juni 2020 um 20:48 Uhr schrieb John Cowan <xxxxxx@ccil.org>:

>> Note that we can get rid of maybe-and maybe-or if we change the
>> semantics of SRFI 189 and set Nothing := #f.
>
>
> A significant advantage of not doing this in a dynamically typed system is that Maybes are disjoint from everything that isn't a Maybe. Allowing the Maybe and boolean types to overlap means that code dispatching on Maybe vs. non-Maybe types has to decide what to do with Nothing/#f.  In statically typed systems, such actions are normally not possible.  Scala has both an Option type with an explicit Nothing and nullable types (where null inhabits every type), and the result is a mess.

I don't have a strong opinion about fusing Nothing with #f as I see
benefits (for example `if', `and', `or' can be used directly with
Maybes without any overhead, which is always good for a language that
is much harder to optimize than C) but also disadvantages because the
semantic model becomes a bit less clear.

I am not sure, though, whether we want to encourage code that does
dynamic dispatching between a Maybe and boolean types. Dynamic
dispatching makes sense for something like the Scheme number tower
where the types are related in a hierarchie, but a procedure that
wants to behave polymorphically with respect to Maybes and booleans
should be split into two.

> Only #f is technically falsy in the sense that conditionals treat it as false.  The others are signal objects, and sometimes #f is too.  Each is suited to a different situation, and this SRFI provides interoperation between them.

While #f is the only technically falsy value, the other values are,
depending on the context, logically likewise singular values.