Re: [PHP-DEV] RFC Proposal: Maybe monad and execution time polymorphic methods

2016-03-28 Thread Facundo Martinez Correa
Hi Stanislav, Yes, as you are saying, it is no easy task. I believe it would make a nice feature, though. I don't know it is really necessary to use union types, I believe that with a class hierarchy would suffice. But maybe there is something that I'm not looking at right, and the unions are need

Re: [PHP-DEV] RFC Proposal: Maybe monad and execution time polymorphic methods

2016-03-28 Thread Facundo Martinez Correa
o2 wrote: > Hi Facundo Martínez, > > I think the best solution to yourself described problem above would be > the Null Object Design Pattern > (https://en.wikipedia.org/wiki/Null_Object_pattern). In my opinion, > NULL belongs to PHP and this language never aimed to become Java or &g

Re: [PHP-DEV] RFC Proposal: Maybe monad and execution time polymorphic methods

2016-03-21 Thread Facundo Martinez Correa
Hi Levi, Thanks for replying. I don't think that automagically taking the T out of the Maybe would be a good idea, mainly because sometimes you don't need the T, you just want to know the result of it. What I would want in that PHP automagically executes the method myMethod(Maybe $object) if somet

[PHP-DEV] RFC Proposal: Maybe monad and execution time polymorphic methods

2016-03-21 Thread Facundo Martinez Correa
Hello, I am reaching you in order to obtain feedback on this RFC proposal. I have been playing with PHP 7 for a project in the company that I am currently working for. One of the many drawbacks that I saw in PHP was the there were no types. With type hinting I had confindence again in PHP. With r