Re: [RFC] Simple Annotations
| From: | Rowan Collins | Date: | Tue, 28 Jun 2016 17:56:10 +0000 |
| Subject: | Re: [RFC] Simple Annotations | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94311@lists.php.net to get a copy of this message | ||
On 28/06/2016 17:31, Rasmus Schultz wrote:
For another, eager construction means we can filter annotations with instanceof rather than by class-name, which is much powerful, enabling you to leverage inheritance - for example, you'd be able to ask directly for all instances of ValidationAnnotation and get those with a single call, which is incredibly useful.Sorry for the extra mail with only one point, but I missed this before. This can be achieved using the fully-qualified class-name by using is_a() or is_subclass_of(). This obviously needs to trigger the autoloader anyway, but can still avoid actually instantiating the class. (And thus, per my other mail, evaluating the args.) I think lazy construction (without magic stub classes) gives the best of both worlds here.