4 ms·
What is the "monad-style behavior" they talk about relating to enums here? I really don't understand the connection, and nothing in the rest of the proposal mak
by vore 6y ago
What is the "monad-style behavior" they talk about relating to enums here? I really don't understand the connection, and nothing in the rest of the proposal makes any mention of it.
- beberlei 6y agoa draft of the RFC contains an example: https://github.com/Crell/enum-comparison/blob/master/rfc.md#maybe https://github.com/Crell/enum-comparison/blob/master/rfc.md#... - I would agree with you that using monad as a term here confuses much more than convinces of the feature.
- zaphar 6y agoThe draft there has a feature that the posted RFC does not. Associated types. Without the associated types you can't have the monadic style behavior which is why I was similarly confused by that wording there. Associated types elevates this from "Oh look a C enum" to actually useful ADT's like in Rust or the ML family of languages. I wonder if the draft you linked will make it into the official rfc or not.
- tored 6y agoThere is meta RFC for enums https://wiki.php.net/rfc/adts https://wiki.php.net/rfc/adts That links to this rfc https://wiki.php.net/rfc/tagged_unions https://wiki.php.net/rfc/tagged_unions