On 3/22/16 1:34 PM, Stephen Coakley wrote:
On 03/21/2016 11:09 PM, Levi Morrison wrote:
This requires you to query state with `isSome()`. This is hardly any
different from a null case, just more code. We can already accurately
distinguish between `null` and another value.

If we want an option for safer PHP code I think we need a safer
construct that requires exhaustive matching (such as Rust's `match`).
I'm not sure how to pull that off.


Certainly. Ideally some sort of `match`, which is listed as future scope in the enum RFC. The above definition of a Maybe is just some sort of basis for a type. You probably wouldn't use `isSome()` much and would use pattern matching on the enum instead.

As much as I do love Rust's type system though, PHP isn't Rust. :)

Correct. So we should just sneak up behind Rust, pick it's pocket, and steal the bits that we can make work for us. That's what PHP's always done to every other language we've encountered. :-)

--
--Larry Garfield


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to