Re: [RFC Discussion] Typed Properties
| From: | Fleshgrinder | Date: | Sun, 20 Mar 2016 13:59:22 +0000 |
| Subject: | Re: [RFC Discussion] Typed Properties | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91787@lists.php.net to get a copy of this message | ||
On 3/20/2016 2:19 PM, Fleshgrinder wrote:
> On 3/19/2016 9:32 PM, Andrea Faulds wrote:
>> This adds a loophole to property type checks which, as previously
>> mentioned, prevents us from performing optimisations. I also don't see
>> why internal functions should be treated specially here, given that
>> surely one could write userland code with the same needs as MySQLi? It
>> doesn't seem intuitive.
>>
>
> It is just code that exists and is used and I am trying to find a
> solution for it together with this new feature. I already wrote that I
> would highly prefer that *mysqli_result::fetch_object* and
> *PDOStatement::fetchObject* work differently but I am not the maintainer
> and I cannot tell if they are willing to change their behavior.
>
> The auto-mapping these methods provide is in general an extremely nice
> thing to have. Plus it is much faster than a comparable userland
> solution; which is of course implementable.
>
Just wanted to add that this is only true for a userland implementation
that does the same as these two methods do because such an
implementation would require reflection.
Creating a *O::fromArray* as it is best practice and feeding it with a
dictionary is faster and much less magic.
--
Richard "Fleshgrinder" Fussenegger
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc