On Sun, Apr 24, 2016 at 1:48 PM, Fleshgrinder <p...@fleshgrinder.com> wrote:

> On 4/24/2016 1:00 PM, Zeev Suraski wrote:
> >
> >
> >> -----Original Message-----
> >> From: Sebastian Bergmann [mailto:sebast...@php.net]
> >> Sent: Sunday, April 24, 2016 12:14 PM
> >> To: internals@lists.php.net
> >> Subject: Re: [PHP-DEV] [RFC] PHP Attributes
> >>
> >> On 04/21/2016 11:13 PM, Dmitry Stogov wrote:
> >>> I would like to present an RFC proposing support for native annotation.
> >>
> >> Dmitry,
> >>
> >> please use "annotation" as the name for this feature and not
> "attribute".
> >>
> >> We already have attributes: it's what we use to store data in objects.
> And
> >> while some people call them "member variables" or "properties" the
> correct
> >> term for them (AFAIK) is "attribute".
> >
> > I don't think I've ever heard properties referred to as attributes in
> the context of PHP.  The PHP manual defines them and refers to them
> throughout as 'properties'.
> >
> > (I'm not voicing an opinion on attributes vs. annotations;  Just
> pointing out that data storage inside objects isn't named attributes).
> >
> > Zeev
> >
>
> The terminology here is pretty clear and you can just look it up, it has
> nothing to do with PHP or Java or whatever. The main problem is simply
> that people do not know the terminology and get mixed up. That is
> usually okay in a casual discussion where each peer understands what the
> other is referring to. However, we are dealing with language
> specification here and need to be very exact or we fuck it up for the
> users.
>
> `$x` is a property in the following example:
>
>   class A {
>     $x;
>   }
>
> https://en.wikipedia.org/wiki/Property_%28programming%29
>
> `private` is an attribute of property `$x` and an access modifier (not
> visibility, because the property is still visible, e.g. via reflection,
> and it only alters access to the property):
>
>   class A {
>     private $x;
>   }
>
> https://en.wikipedia.org/wiki/Attribute_%28computing%29
>
> Note that these things go further up in the terminology hierarchy to:
> Field - https://en.wikipedia.org/wiki/Field_%28computer_science%29
> Record - https://en.wikipedia.org/wiki/Record_%28computer_science%29
> Data Structure - https://en.wikipedia.org/wiki/Data_structure
>
> This is not the whole image yet, there are more things like (random order):
> - functions
> - methods
> - members
> - class variables
> - static variables
> - behavior
> - data
> - ...
>
> You will notice, if you read all Wikipedia articles and related
> documents, that these terms are too often used interchangeable. This is,
> as mentioned before, mainly the case because people to not care about
> terminology in general.
>
> To sum it up, calling them attributes is outright wrong because not all
> parts of a source code of a programming language has attributes. That is
> why Sun chose the word annotation. Annotation means metadata that was
> added to data. It does not say anything about the data itself and it
> does not necessarily alter the data in any way, however, it can. This is
> exactly what this feature is about. Since, an entity annotation does not
> alter the data (in this case a class) itself but this additional
> metadata may be used to configure other parts of the program.
>
> The same is true for a method that has been annotated with test. The
> data is not altered at all but is helps other parts of the program to
> configure specific data and behavior based on this additional metadata
> that was added to the data. Execution of the same method without those
> other parts that react on the metadata does not do anything and the
> program will execute normally.
>
> TL;DR this feature *MUST* be called annotations (unless someone knows an
> even better term) and the annotations *MAY* be used to add attributes to
> properties but for many other things too.
>

The article *you* reference about attributes lists C# attributes as the
*first* example.

And defines an attribute as:

"For clarity, attributes should more correctly be considered metadata
<https://en.wikipedia.org/wiki/Metadata>. An attribute is frequently and
generally a property of a property."

HHVM uses the name attribute, for the same syntax that Dimitry proposes
here.

*MUST* is such a strong word in this context, this is not an 0 XOR 1 issue.

>
> --
> Richard "Fleshgrinder" Fussenegger
>
>

Reply via email to