Re: Attributes/Annotations Case Study: Drupal
| From: | Rowan Collins | Date: | Sat, 30 Apr 2016 23:21:48 +0000 |
| Subject: | Re: Attributes/Annotations Case Study: Drupal | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93013@lists.php.net to get a copy of this message | ||
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]