> On 6 Sep 2019, at 11:22, Mike Schinkel <m...@newclarity.net> wrote:
> 
> Hi Côme,
> 
>> This example is really confusing me more than anything else.
> 
> 
> Thank you very much for your feedback.  You illustrated perfectly why I 
> should not have produced that proposal in haste.
> 
> Your confusion was due to my first draft errors, which thanks to your 
> feedback I have hopefully had a chance to correct. I effectively rewrote and 
> extended the proposal which you should be able to find at the same URL:
> 
> https://gist.github.com/mikeschinkel/50aec7094f5643223d28674639f9f117 
> <https://gist.github.com/mikeschinkel/50aec7094f5643223d28674639f9f117>
> 
> I would be greatly appreciative if you could give is a second look.
> 
> 
>> All in all I do not understand the benefits of this approach compared to 
>> Nikita’s RFC.
> 
> I have moved the benefits to the beginning of the document and expanded the 
> list I elaborate on. 
> 
> Hopefully they will be clear now?
> 
> 
> -Mike Schinkel
> 
> P.S. Someone graciously emailed me off list and mentioned that my comments 
> regarding Nikitia sounded like a criticism. If anyone else thought the same — 
> and especially Nikita — please understand I was attempting to praise him but 
> trying to do so in a humorous manner. 
> 
> As the person who emailed me made me realize, sometimes my humor may not 
> translate via a mailing list and especially not for those who are not native 
> English speakers. So I will do my best to avoid using humor on the list in 
> the future.  
> 
> To be clear, I am in awe of Nikita and both his abilities and efforts to 
> benefit the PHP community and greatly appreciate his efforts. I hope that 
> clarifies my earlier intent.
> 
> 
>> On Sep 5, 2019, at 4:51 AM, Côme Chilliet  wrote:
>> 
>> Why does the class Number in the example has a $number property and use 
>> $this->number->value() rather than $this->value() ?
>> 
>> What is the difference between its getNumber method and its value method?
>> 
>> Is $this->number and $this->number->number pointing the same object or is 
>> $this->number->number NULL?
>> 
>> This example is really confusing me more than anything else.
>> 
>> The "function showNumber" example is using $this->number instead of $number 
>> I think.
>> 
>> All in all I do not understand the benefits of this approach compared to 
>> Nikita’s RFC.
>> What does this allow you to do that you cannot do without?
>> 
>> Côme
> 

Hi Mike,

From a userland perspective I don’t really “get” your proposal.

It seems like you’re trying to allow for type conversions in a predictable 
manner, but in a very different way than php already does that with built in 
types and interfaces (__toString, the proposed __toArray, plus the various 
(de)serialiser options)

Your proposal seems to imply some kind of automatic method generation by the 
engine itself (or the examples are all missing that boilerplate??) which is 
very non obvious to me and I think would be to others too.


From my perspective a more obvious solution for this type of thing (and I’m not 
necessarily sure I’d use the feature myself to be honest) would be a set of 
interfaces (or magic methods to match __toString but I know they’re less 
preferred by some these days) to define that a class can be safely cast to 
another type when used with typed properties/arguments/returns.


Cheers

Stephen

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

Reply via email to