On 30/04/2016 23:45, Stanislav Malyshev wrote:
Oh, of course you can have methods, but then it is strange conceptually
- you have a normal class, which some other part of the language just
uses for something else that classes are not routinely used for. I.e.,
does it call a constructor? When? With which arguments? What if it
fails? What if I just create an object of this class - would it be the
same as annotation object?

Hm... I was going to say "well, PDO does this if you use PDOStatement::fetchObject"; but then I remembered that the integration with the object there IS a bit weird - it injects raw properties, and *then* calls the constructor.

So, I'm not sure there's a limitation in terms of the object being data-only per se, but there are certainly oddities to be dealt with in terms of construction. And as you mentioned, mutability leads to another set of oddities - are the mutations stored for next time you request that annotation, or is the object recreated on each access?

Regards,

--
Rowan Collins
[IMSoP]


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

Reply via email to