Re: [RFC] PHP Attributes

From: Date: Sun, 24 Apr 2016 12:54:58 +0000
Subject: Re: [RFC] PHP Attributes
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-92690@lists.php.net to get a copy of this message
Another way to illustrate what I mean: The feature will be used /to annotate/ (add metadata) and the so /annotated/ data has additional /attributes/ afterwards. Trying building the sentence if the feature is called /attributes/. @entity @invariant final class A { @inject private static $x; @test public memoized function f(){} } r = reflect A r.getModifiers = [ final ] r.getAnnotations = [ entity, invariant ] r.getAttributes = [ final, entity, invariant ] r = reflect A.x r.getModifiers = [ private, static ] r.getAnnotations = [ inject ] r.getAttributes = [ private, static, inject ] r = reflect A.f r.getModifiers = [ public, memoized ] r.getAnnotations = [ test ] r.getAttributes = [ public, memoized, test ] Note that there are programming languages that allow adding of metadata solely via annotations: Ceylon. No matter the data to annotate. Hence, in Ceylon no differentiation would be made between modifiers and annotations. However, one could check the actual annotation type to determine what it is. https://modules.ceylon-lang.org/repo/1/ceylon/language/1.2.2/module-doc/api/index.html#section-annotations -- Richard "Fleshgrinder" Fussenegger

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#92690) next »