On Mon, 2012-01-30 at 12:15 -0500, Rasmus Schultz wrote:
> 
> 
> Well, my thinking was, in my annotation engine, rather than globally
> registering aliases for fully-qualified annotation-type class-names, I
> would support the use-statement.
> 
> This is generally how it works in other languages (such as C#) that
> have built-in support for annotations.
> 
> So you'd be able to say "use VendorName\AnnotationLibrary
> \SomeAnnotation" at the top of your script, and emulating the PHP
> name-resolution rules, you would then be able to annotation
> classes/properties simply with "@some" rather than the full
> class-name.

In C# you'd still have the compiled assembly around ... actually the
reflected part would even be part to the reflected component, similar to
what you have after doing an include() in PHP.

.. and annotations are different from PHP Reflection, there was a
(rejected) RFC on annotations recently.

> I know this is very specific to my project, but I could see this being
> important to other aspects of meta-programming with PHP in general.
> Clearly I'm not the first person who has needed this - there are
> numerous (more or less complete) implementations around the net...

No, it's not too specific. Static analysis and annotations are common
requests.

> Although as said, I see your argument about time/effort vs usefulness,
> and I do agree, there are probably other areas of PHP in need of more
> immediate attention than this one. It is a problem that can be solved
> with user-code, although, as always, that means varying APIs of
> varying quality, and most likely some degree of duplication, since
> each library that needs these feature is going to implement this
> feature in different ways...

One might argue this in a more positive way: There's competition and the
best solution will win. One might argue in yet another way: We need a
CPAN for PHP (PEAR anybody?)

The only argument against doing stuff in userland I see is "performance"
and usually the performance issue is somewhere else already and such
things can be neglected ...

johannes
  who would love to make the PHP distribution *a lot* smaller



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

Reply via email to