> My experience in Haskell reminded me of this. To have a structure than
> represents uncertainty, is the best way to take away the responsibility
> from NULL. To express it in no other way. But my experience in Java has
> taught me that Optional of something is not a good way to tackle the
> problem. I still have to check if my Optional isEmpty. I still have to
> check for null. That is because Java has that type erasure after
> compilation time that doesn't allow me to play nice with polymorphism. But
> maybe PHP can. Maybe PHP will give me the polymorphism at execution time to
> discern an empty Maybe from the one that is not. So I don't have to check
> for null ever again in my life. So my code can be free of nulls. So I can
> express uncertainty and nonexistance, while I return a User from my
> repository.

I don't fully understand what you are asking for here. You want a
Maybe<T> to automatically become a T if it's not null or something?

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

Reply via email to