I am writing this in a separate thread because of the urgency that I see
regarding the naming of past, current, and future proposals regarding
this functionality.
It was and is proposed to create this feature with the name Attributes
as Facebook did in their Hack language. Main argument is to blindly
follow /because/.
Different languages names this differently.
I may add an additional voting question - "annotation vs attributes?".
It is true and only natural that different languages choose different
names for equivalent features but this discussion is not about taste,
style, nor coolness. It is about natural language, proper computer
science terminology, and what PHP users will search for in search
engines. I already tried to explain this in the actual thread but I
guess my attempts resulted in more confusion than clarification, let me
try again.
ATTRIBUTE
The word attribute has several meanings in computer science and this
is mainly due to its extremely generic nature:
a usually good quality or feature that someone or something has
In computing, an attribute is a specification that defines a property
of an object, element, or file. [...] For clarity, attributes should
more correctly be considered metadata. An attribute is frequently and
generally a property of a property.
This pretty much sums it up already. An attribute is the metadata that
is attached to an element of source code. This metadata is anything
unessential that is additionally added but not necessarily required.
class A {
var $x;
}
The class
and var
keywords are essential in this example and define
the actual element and the names are required too.
public final class A {
private static int $x = 42;
}
Class A has the attributes public
and final
.
Property $x
has the attributes private
, static
, int
, and 42
.
All of these attributes of the class and the property add additional
metadata to the source code elements that define their qualities or
features and consequently their behavior and usage.
http://www.onelook.com/?w=attribute&ls=a
http://encyclopedia2.thefreedictionary.com/attribute
Sebastian Bergmann already explained this but I think it is important to
be repeated and further clarified. The word attribute is often used to
refer to properties with additional metadata (e.g. access modifiers,
default values, ...; illustrated above) in an OO context. This makes the
usage of the word attribute additionally to its generic nature ambiguous
as well:
https://en.wikipedia.org/wiki/Attribute_%28computing%29
http://encyclopedia2.thefreedictionary.com/instance+attribute
https://en.wikipedia.org/wiki/Instance_variable
http://encyclopedia2.thefreedictionary.com/static+attribute
https://en.wikipedia.org/wiki/Static_variable
All userland implementations that are called /attributes/ in the free
and open world deal with completely different things:
https://packagist.org/search/?q=attribute
Last but not least, Perl has /attribute/ support. However, Perl actually
uses it for interaction with all attributes that can be set. Hence,
this is what attributes really do.
http://perldoc.perl.org/attributes.html
ANNOTATION
Extra information associated with a particular point in a document or
program. Annotations may be added either by a compiler or by the
programmer. They are not usually essential to the correct function of
the program but give hints to improve performance.
http://www.onelook.com/?w=annotation&ls=a
The term annotation is not only used by Java:
https://packagist.org/search/?q=annotation
https://en.wikipedia.org/wiki/Annotation
https://en.wikipedia.org/wiki/Ruby_character
https://en.wikipedia.org/wiki/Java_annotation
https://msdn.microsoft.com/en-us/library/dd901590%28VS.95%29.aspx
http://docs.scala-lang.org/tutorials/tour/annotations.html
https://kotlinlang.org/docs/reference/annotations.html
https://www.python.org/dev/peps/pep-3107/
https://ghc.haskell.org/trac/ghc/wiki/Annotations
http://ceylon-lang.org/documentation/1.2/tour/annotations/
http://clojure-doc.org/articles/ecosystem/core_typed/start/annotations.html
https://www.dartlang.org/effective-dart/style/
...
https://rubygems.org/search?utf8=%E2%9C%93&query=annotation
http://rustbyexample.com/scope/lifetime/explicit.html
https://www.google.de/search?q=javascript+annotation
...
Ignoring these facts just because Facebook did not do proper research is
a total no go. It is also not up for a vote, it is just proper English
and computer science terminology!
Last but not least, it also ensures that users find the correct PHP
manual page when they search for this new feature that might make it
into core at some point. :)
Richard "Fleshgrinder" Fussenegger
Fleshgrinder php@fleshgrinder.com schrieb am Mi., 27. Apr. 2016 22:11:
I am writing this in a separate thread because of the urgency that I see
regarding the naming of past, current, and future proposals regarding
this functionality.It was and is proposed to create this feature with the name Attributes
as Facebook did in their Hack language. Main argument is to blindly
follow /because/.Different languages names this differently.
I may add an additional voting question - "annotation vs attributes?".It is true and only natural that different languages choose different
names for equivalent features but this discussion is not about taste,
style, nor coolness. It is about natural language, proper computer
science terminology, and what PHP users will search for in search
engines. I already tried to explain this in the actual thread but I
guess my attempts resulted in more confusion than clarification, let me
try again.ATTRIBUTE
The word attribute has several meanings in computer science and this
is mainly due to its extremely generic nature:a usually good quality or feature that someone or something has
In computing, an attribute is a specification that defines a property
of an object, element, or file. [...] For clarity, attributes should
more correctly be considered metadata. An attribute is frequently and
generally a property of a property.This pretty much sums it up already. An attribute is the metadata that
is attached to an element of source code. This metadata is anything
unessential that is additionally added but not necessarily required.class A {
var $x;
}The
class
andvar
keywords are essential in this example and define
the actual element and the names are required too.public final class A {
private static int $x = 42;
}Class A has the attributes
public
andfinal
.
Property$x
has the attributesprivate
,static
,int
, and42
.All of these attributes of the class and the property add additional
metadata to the source code elements that define their qualities or
features and consequently their behavior and usage.http://www.onelook.com/?w=attribute&ls=a
http://encyclopedia2.thefreedictionary.com/attributeSebastian Bergmann already explained this but I think it is important to
be repeated and further clarified. The word attribute is often used to
refer to properties with additional metadata (e.g. access modifiers,
default values, ...; illustrated above) in an OO context. This makes the
usage of the word attribute additionally to its generic nature ambiguous
as well:https://en.wikipedia.org/wiki/Attribute_%28computing%29
http://encyclopedia2.thefreedictionary.com/instance+attribute
https://en.wikipedia.org/wiki/Instance_variablehttp://encyclopedia2.thefreedictionary.com/static+attribute
https://en.wikipedia.org/wiki/Static_variableAll userland implementations that are called /attributes/ in the free
and open world deal with completely different things:https://packagist.org/search/?q=attribute
Last but not least, Perl has /attribute/ support. However, Perl actually
uses it for interaction with all attributes that can be set. Hence,
this is what attributes really do.http://perldoc.perl.org/attributes.html
ANNOTATION
Extra information associated with a particular point in a document or
program. Annotations may be added either by a compiler or by the
programmer. They are not usually essential to the correct function of
the program but give hints to improve performance.http://www.onelook.com/?w=annotation&ls=a
The term annotation is not only used by Java:
https://packagist.org/search/?q=annotation
https://en.wikipedia.org/wiki/Annotation
https://en.wikipedia.org/wiki/Ruby_character
https://en.wikipedia.org/wiki/Java_annotationhttps://msdn.microsoft.com/en-us/library/dd901590%28VS.95%29.aspx
http://docs.scala-lang.org/tutorials/tour/annotations.html
https://kotlinlang.org/docs/reference/annotations.html
https://www.python.org/dev/peps/pep-3107/
https://ghc.haskell.org/trac/ghc/wiki/Annotations
http://ceylon-lang.org/documentation/1.2/tour/annotations/
http://clojure-doc.org/articles/ecosystem/core_typed/start/annotations.html
https://www.dartlang.org/effective-dart/style/
...https://rubygems.org/search?utf8=%E2%9C%93&query=annotation
http://rustbyexample.com/scope/lifetime/explicit.html
https://www.google.de/search?q=javascript+annotation
...Ignoring these facts just because Facebook did not do proper research is
a total no go. It is also not up for a vote, it is just proper English
and computer science terminology!Last but not least, it also ensures that users find the correct PHP
manual page when they search for this new feature that might make it
into core at some point. :)Richard "Fleshgrinder" Fussenegger
I agree with all of that, +1.
2016-04-27 22:53 GMT+02:00 Niklas Keller me@kelunik.com:
Fleshgrinder php@fleshgrinder.com schrieb am Mi., 27. Apr. 2016 22:11:
I am writing this in a separate thread because of the urgency that I see
regarding the naming of past, current, and future proposals regarding
this functionality.It was and is proposed to create this feature with the name Attributes
as Facebook did in their Hack language. Main argument is to blindly
follow /because/.Different languages names this differently.
I may add an additional voting question - "annotation vs attributes?".It is true and only natural that different languages choose different
names for equivalent features but this discussion is not about taste,
style, nor coolness. It is about natural language, proper computer
science terminology, and what PHP users will search for in search
engines. I already tried to explain this in the actual thread but I
guess my attempts resulted in more confusion than clarification, let me
try again.ATTRIBUTE
The word attribute has several meanings in computer science and this
is mainly due to its extremely generic nature:a usually good quality or feature that someone or something has
In computing, an attribute is a specification that defines a property
of an object, element, or file. [...] For clarity, attributes should
more correctly be considered metadata. An attribute is frequently and
generally a property of a property.This pretty much sums it up already. An attribute is the metadata that
is attached to an element of source code. This metadata is anything
unessential that is additionally added but not necessarily required.class A {
var $x;
}The
class
andvar
keywords are essential in this example and define
the actual element and the names are required too.public final class A {
private static int $x = 42;
}Class A has the attributes
public
andfinal
.
Property$x
has the attributesprivate
,static
,int
, and42
.All of these attributes of the class and the property add additional
metadata to the source code elements that define their qualities or
features and consequently their behavior and usage.http://www.onelook.com/?w=attribute&ls=a
http://encyclopedia2.thefreedictionary.com/attributeSebastian Bergmann already explained this but I think it is important to
be repeated and further clarified. The word attribute is often used to
refer to properties with additional metadata (e.g. access modifiers,
default values, ...; illustrated above) in an OO context. This makes the
usage of the word attribute additionally to its generic nature ambiguous
as well:https://en.wikipedia.org/wiki/Attribute_%28computing%29
http://encyclopedia2.thefreedictionary.com/instance+attribute
https://en.wikipedia.org/wiki/Instance_variablehttp://encyclopedia2.thefreedictionary.com/static+attribute
https://en.wikipedia.org/wiki/Static_variableAll userland implementations that are called /attributes/ in the free
and open world deal with completely different things:https://packagist.org/search/?q=attribute
Last but not least, Perl has /attribute/ support. However, Perl actually
uses it for interaction with all attributes that can be set. Hence,
this is what attributes really do.http://perldoc.perl.org/attributes.html
ANNOTATION
Extra information associated with a particular point in a document or
program. Annotations may be added either by a compiler or by the
programmer. They are not usually essential to the correct function of
the program but give hints to improve performance.http://www.onelook.com/?w=annotation&ls=a
The term annotation is not only used by Java:
https://packagist.org/search/?q=annotation
https://en.wikipedia.org/wiki/Annotation
https://en.wikipedia.org/wiki/Ruby_character
https://en.wikipedia.org/wiki/Java_annotationhttps://msdn.microsoft.com/en-us/library/dd901590%28VS.95%29.aspx
http://docs.scala-lang.org/tutorials/tour/annotations.html
https://kotlinlang.org/docs/reference/annotations.html
https://www.python.org/dev/peps/pep-3107/
https://ghc.haskell.org/trac/ghc/wiki/Annotations
http://ceylon-lang.org/documentation/1.2/tour/annotations/http://clojure-doc.org/articles/ecosystem/core_typed/start/annotations.html
https://www.dartlang.org/effective-dart/style/
...https://rubygems.org/search?utf8=%E2%9C%93&query=annotation
http://rustbyexample.com/scope/lifetime/explicit.html
https://www.google.de/search?q=javascript+annotation
...Ignoring these facts just because Facebook did not do proper research is
a total no go. It is also not up for a vote, it is just proper English
and computer science terminology!Last but not least, it also ensures that users find the correct PHP
manual page when they search for this new feature that might make it
into core at some point. :)Richard "Fleshgrinder" Fussenegger
I agree with all of that, +1.
Hi,
personally I prefer Annotation word instead of Attributes because of my
language (Polish) discrepancies in usage as "class attribute" in Polish
means quite the same as "object property" in English and may came to
missusage of that name - this info is also on Wikipedia
https://pl.wikipedia.org/wiki/Atrybut_(programowanie)#Poj.C4.99cie_atrybutu_w_programowaniu_obiektowym
Annotation in Polish in Software Development is uniquely associated with
the Attributes in your meaning exactly the same as Java Annotaitons and
this is clearly understood for eg. Cay S. Hortsmann in "Java 8"
in translation into Polish is talking about Annotations.
For eg. in Symfony docs translation into Polish
http://symfony-docs.pl/bundles/SensioFrameworkExtraBundle/index.html also
is usage of Annotation (Ctrl+F "adnotacje") - this is official
documentation.
Thats why IMHO Annotation name should be retained.
Thanks,
Regards,
Michał Brzuchalski
It is about natural language, proper computer
science terminology, and what PHP users will search for in search
engines.
To add to your list ...
https://www.phpdoc.org/docs/latest/guides/docblocks.html
The glossary entry is rather bare, but I would dispute THEIR statement -
"but also influences the way the application behaves."
In my book, these comment blocks are 'annotation' is it's simplest form,
and we add tags within that annotation to make particular details of
that annotation both machine readable and humanly prominent. That some
of these keys may be used to "influences the way the application
behaves." is secondary?
My continuing irritation is that while subsets keep getting discussed as
duplicate elements outside of the phpdoc wrapper, there is no provision
for the annotations that would actually help data validation.
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
To add to your list ...
https://www.phpdoc.org/docs/latest/guides/docblocks.htmlThe glossary entry is rather bare, but I would dispute THEIR statement -
"but also influences the way the application behaves."In my book, these comment blocks are 'annotation' is it's simplest form,
and we add tags within that annotation to make particular details of
that annotation both machine readable and humanly prominent. That some
of these keys may be used to "influences the way the application
behaves." is secondary?
It is totally secondary but still possible, hence, stating it is
correct. A problem is the that attributes that were added via
annotations are per definition not guaranteed to be executed (influence
the way the application behaves) and are as such not a good fit for
design by contract, validation, nor security checks. However, "per
definition" does not mean that one is not allowed to model it in such a way.
My continuing irritation is that while subsets keep getting discussed as
duplicate elements outside of the phpdoc wrapper, there is no provision
for the annotations that would actually help data validation.
Value objects are a better approach towards validation in the very core
than annotations could ever be.
Validation of user input should happen at the most outer layer to fail
early.
Validation of developers should happen via design by contract where we
currently only have assert()
at our disposal.
--
Richard "Fleshgrinder" Fussenegger
Fleshgrinder wrote on 27/04/2016 21:11:
I am writing this in a separate thread because of the urgency that I see
regarding the naming of past, current, and future proposals regarding
this functionality.
While I personally prefer the name "annotations", I don't see it as
particularly urgent, or nearly as clear-cut as you claim.
I clicked through on your MSDN link [1] because I was pretty sure .net
referred to them as "attributes", and am amused to find sentences like this:
The System.ComponentModel.DataAnnotations namespace contains the
classes that are used as data attributes.
In other words, the implementer of that particular library preferred the
word "annotations", but the language/framework itself calls them
"attributes"; here's a nice summary [2]:
For example, the accessibility of a method in a class is specified by
decorating it with the /method-modifiers/ |public|, |protected|,
|internal|, and |private|. C# enables programmers to invent new kinds of
declarative information, called attributes.
So, that's one rather large ecosystem that calls them "attributes".
Your claims for Perl also don't make much sense:
Last but not least, Perl has/attribute/ support. However, Perl actually
uses it for interaction withall attributes that can be set. Hence,
this is what attributes really do.
None of the built-in attributes mentioned in that manual are standard
syntax used in the majority of Perl programs; in fact, they are all
marked as experimental, and most of the examples are of defining custom
attributes. As far as I can see, this is Perl's version of precisely the
feature that is being proposed for PHP.
I haven't looked through any of your other links to see if you've fallen
foul of similar confirmation bias, but am satisfied in my mind that
there are plenty of people outside Hack who call them "attributes".
[1] https://msdn.microsoft.com/en-us/library/dd901590%28VS.95%29.aspx
[2] https://msdn.microsoft.com/en-us/library/aa664611%28v=vs.71%29.aspx
Regards,
Rowan Collins
[IMSoP]
While I personally prefer the name "annotations", I don't see it as
particularly urgent, or nearly as clear-cut as you claim.
That's okay and why we are discussing things. ;)
I clicked through on your MSDN link [1] because I was pretty sure .net
referred to them as "attributes", and am amused to find sentences like
this:The System.ComponentModel.DataAnnotations namespace contains the
classes that are used as data attributes.In other words, the implementer of that particular library preferred the
word "annotations", but the language/framework itself calls them
"attributes"; here's a nice summary [2]:For example, the accessibility of a method in a class is specified by
decorating it with the /method-modifiers/ |public|, |protected|,
|internal|, and |private|. C# enables programmers to invent new kinds of
declarative information, called attributes.So, that's one rather large ecosystem that calls them "attributes".
Actually Microsoft got it exactly right and they are explaining in depth
what I wrote as well. The result of an annotation is an attribute. So it
is only natural to call the classes attributes.
public class Customer {
[DataType(DataType.EmailAddress)]
public string EmailAddress { get; set; }
}
The [DataType(DataType.EmailAddress)]
is the annotation and the
attribute that we add to the property is a DataTypeAttribute of DataType
EmailAddress.
Note that you could achieve the above in PHP with the property type RFC:
class Customer {
public EmailAddress $email;
}
Here public and EmailAddress are attributes of the instance variable
email and hence properties of a property that together result in a class
or instance attribute.
Your claims for Perl also don't make much sense:
Last but not least, Perl has/attribute/ support. However, Perl actually
uses it for interaction withall attributes that can be set. Hence,
this is what attributes really do.None of the built-in attributes mentioned in that manual are standard
syntax used in the majority of Perl programs; in fact, they are all
marked as experimental, and most of the examples are of defining custom
attributes. As far as I can see, this is Perl's version of precisely the
feature that is being proposed for PHP.
The name they chose is okay because Perl does not offer any other way of
adding attributes to any kind of data in any way (at least none that I
am aware off but I am not a Perl programmer). Hence, it is not too
dangerous to call this functionality attributes as it would be in our
context where many other attributes are already available.
The fact that it is experimental does not add anything to this discussion.
I haven't looked through any of your other links to see if you've fallen
foul of similar confirmation bias, but am satisfied in my mind that
there are plenty of people outside Hack who call them "attributes".[1] https://msdn.microsoft.com/en-us/library/dd901590%28VS.95%29.aspx
[2] https://msdn.microsoft.com/en-us/library/aa664611%28v=vs.71%29.aspxRegards,
No confirmation bias and as I said, Microsoft got it completely right.
To give you an analogy, Microsoft is calling the egg an egg and the
chicken a chicken. We would be calling a chicken an egg because it is
able to create eggs.
In other words: an annotation allows you to add additional custom
attributes to data that cannot be added by other means.
:)
--
Richard "Fleshgrinder" Fussenegger
Fleshgrinder wrote on 28/04/2016 18:33:
Actually Microsoft got it exactly right and they are explaining in depth
what I wrote as well. The result of an annotation is an attribute. So it
is only natural to call the classes attributes.public class Customer {
[DataType(DataType.EmailAddress)] public string EmailAddress { get; set; }
}
The
[DataType(DataType.EmailAddress)]
is the annotation and the
attribute that we add to the property is a DataTypeAttribute of DataType
EmailAddress.
Interesting; do you have a link to where this terminology is explained?
Most of the articles I've seen just refer to "attributes", and the link
you have doesn't really explain that at all, it has namespaces with
"annotation" in the name, but uses the word "attribute" everywhere in
the actual text.
According to this page, the syntax which applies an attribute to some
code is called an "attribute specification":
https://msdn.microsoft.com/en-us/library/aa664616.aspx
Here public and EmailAddress are attributes of the instance variable
email and hence properties of a property that together result in a class
or instance attribute.
Again, I've not seen anything saying that .net refers to the "public"
keyword as an "attribute", or in any way treats it as equivalent to the
attribute (or, if you insist, annotation) syntax. In fact, the article I
quoted earlier explicitly distinguishes the two, referring to "public"
etc as "method-modifiers", and seems clear to me that they are not the
same thing as attributes:
https://msdn.microsoft.com/en-us/library/aa664611%28v=vs.71%29.aspx
The name they chose is okay because Perl does not offer any other way of
adding attributes to any kind of data in any way (at least none that I
am aware off but I am not a Perl programmer). Hence, it is not too
dangerous to call this functionality attributes as it would be in our
context where many other attributes are already available.
Surely under your definition scope modifiers like "local"/"global" and
"my"/"our" would be "attributes"? I think you're really clutching at
straws to distinguish this case from any of the others, just because it
doesn't agree with your assumptions.
I haven't looked through any of your other links to see if you've fallen
foul of similar confirmation bias, but am satisfied in my mind that
there are plenty of people outside Hack who call them "attributes".
No confirmation bias
By "confirmation bias", I meant that you'd gone out looking for
confirmation that people called them "annotations", rather than
researching what each language calls them.
For instance, you linked to a Rust page, which happened to contain the
word "annotation", but on closer inspection is actually using the terms
in exactly the opposite way from you: the "lifetime annotation" here is
a specific syntax to do with lifetimes, and is an "annotation" in the
loose sense of "you are annotating the source code". Meanwhile, in the
menu on the left, we can see a section on "Attributes", which look much
more like arbitrary metadata of the sort we are discussing right now:
http://rustbyexample.com/attribute.html
I think a survey of what different languages call their metadata
features would be interesting, but so far, I'm not seeing a clear bias
in favour of one or the other.
Like I say, I personally prefer the term "annotations", but I'm not
going to discount the evidence that major languages like C#/.net, Perl,
and Rust have chosen the name "attributes" instead.
Regards,
Rowan Collins
[IMSoP]
Interesting; do you have a link to where this terminology is explained?
Most of the articles I've seen just refer to "attributes", and the link
you have doesn't really explain that at all, it has namespaces with
"annotation" in the name, but uses the word "attribute" everywhere in
the actual text.
Yes, I provided many in the initial message, the Wikipedia link [1]
explains it in detail and you may use it as reference for all the other
questions you have here, since it answers all of them. Emphasize mine:
You can also use attributes to control memory placement, code
generation options or call/return conventions within the function
being annotated.--- https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
We /annotate/ data and by doing so we add /attributes/.
The C language is a very good example where all attributes are directly
called attributes because there is no other system available to add
attributes. In PHP we have various means to add attributes, so does
Java. That is why it is not a good idea to call a specific
functionality /attributes/.
According to this page, the syntax which applies an attribute to some
code is called an "attribute specification":
https://msdn.microsoft.com/en-us/library/aa664616.aspx
The word construct "attribute specification" is completely right, it
specifies which attribute should be applied to the data. The
functionality at our disposal to do so---addition and specification of
attributes---is through annotating them. Hence, calling the
functionality ...
- Custom Attributes
- Attribute Specifiers
- Custom Attribute Specifiers
- Extended Attributes
... or something in this vain would get my +1. However, all of them are
rather bulky.
Again, I've not seen anything saying that .net refers to the "public"
keyword as an "attribute", or in any way treats it as equivalent to the
attribute (or, if you insist, annotation) syntax. In fact, the article I
quoted earlier explicitly distinguishes the two, referring to "public"
etc as "method-modifiers", and seems clear to me that they are not the
same thing as attributes:
https://msdn.microsoft.com/en-us/library/aa664611%28v=vs.71%29.aspx
Method modifiers are a more specialized form of attributes and it makes
sense to refer to them as such because it is less ambiguous than the
word attributes. [1]
BTW: /public/, /protected/, and /private/ are a special form of
modifiers in general and called access modifiers:
https://en.wikipedia.org/wiki/Access_modifiers
The name they chose is okay because Perl does not offer any other way of
adding attributes to any kind of data in any way (at least none that I
am aware off but I am not a Perl programmer). Hence, it is not too
dangerous to call this functionality attributes as it would be in our
context where many other attributes are already available.Surely under your definition scope modifiers like "local"/"global" and
"my"/"our" would be "attributes"? I think you're really clutching at
straws to distinguish this case from any of the others, just because it
doesn't agree with your assumptions.
As I said in the initial message, using the term /attribute/ is pretty
much never wrong because the term /attribute/ is so generic. :P
The only data without any kind of attributes is raw binary data without
any meaning. Note that random data does not count, since randomness
would be an attribute of the data.
a usually good quality or feature that someone or something has
By "confirmation bias", I meant that you'd gone out looking for
confirmation that people called them "annotations", rather than
researching what each language calls them.
Actually I checked the dictionaries for the actual definition. This is
also how I documented it in the initial message. All additional language
links were only used to proof that Java is not the only language that
uses the term and that the term is always used in the context.
For instance, you linked to a Rust page, which happened to contain the
word "annotation", but on closer inspection is actually using the terms
in exactly the opposite way from you: the "lifetime annotation" here is
a specific syntax to do with lifetimes, and is an "annotation" in the
loose sense of "you are annotating the source code". Meanwhile, in the
menu on the left, we can see a section on "Attributes", which look much
more like arbitrary metadata of the sort we are discussing right now:
http://rustbyexample.com/attribute.html
That is why there is an empty line between the pages that are actually
documenting the usage of an annotation functionality and the pages that
are using the term annotation correctly in natural language to describe
something. Again, it is about language and terminology.
Here is the relevant formatting again, note the dots and empty line:
http://ceylon-lang.org/documentation/1.2/tour/annotations/
http://clojure-doc.org/articles/ecosystem/core_typed/start/annotations.html
https://www.dartlang.org/effective-dart/style/
...https://rubygems.org/search?utf8=%E2%9C%93&query=annotation
http://rustbyexample.com/scope/lifetime/explicit.html
https://www.google.de/search?q=javascript+annotation
...
I think a survey of what different languages call their metadata
features would be interesting, but so far, I'm not seeing a clear bias
in favour of one or the other.Like I say, I personally prefer the term "annotations", but I'm not
going to discount the evidence that major languages like C#/.net, Perl,
and Rust have chosen the name "attributes" instead.Regards,
Me neither, I am saying that the term is too generic and that we should
use the term annotation in order to make it unique, easily
understandable, non-ambiguous in terms of natural language and not in
terms of what others use or do.
[1] https://en.wikipedia.org/wiki/Attribute_%28computing%29
--
Richard "Fleshgrinder" Fussenegger
Fleshgrinder wrote on 28/04/2016 20:20:
Interesting; do you have a link to where this terminology is explained?
Most of the articles I've seen just refer to "attributes", and the link
you have doesn't really explain that at all, it has namespaces with
"annotation" in the name, but uses the word "attribute" everywhere in
the actual text.Yes, I provided many in the initial message, the Wikipedia link [1]
explains it in detail and you may use it as reference for all the other
questions you have here, since it answers all of them.
I meant specifically in the context of C#/.net. You claimed a very
specific usage within that framework, but all the articles I can find
refer to them consistently as "attributes" in that context. Event the
Wikipedia article:
In the C# programming language, attributes are [...] equivalent to
annotations in Java.
That's pretty clear to me that the two languages call the same concept
different things.
The word construct "attribute specification" is completely right, it
specifies which attribute should be applied to the data.
But it completely disagrees with your earlier claim that "The result of
an annotation is an attribute." There is absolutely no usage of
"annotation" in that page; there is just a description of syntax for
applying "attributes".
Method modifiers are a more specialized form of attributes and it makes
sense to refer to them as such because it is less ambiguous than the
word attributes.
It may make sense, but can you point me to any C#/.net documentation
which describes that relationship? I'm talking about actual usage here,
not theoretical definitions.
As I said in the initial message, using the term /attribute/ is pretty
much never wrong because the term /attribute/ is so generic. :P
What kind of answer is that? The page clearly describes a Perl feature
very similar to the feature proposed for PHP, and it very clearly calls
it "attributes". If it's "never wrong" for Perl, surely it's "never
wrong" for PHP either?
Actually I checked the dictionaries for the actual definition. This is
also how I documented it in the initial message. All additional language
links were only used to proof that Java is not the only language that
uses the term and that the term is always used in the context.
I have already pointed out that 3 of those links do not back up your
claim. You appear to dispute this, but I'm increasingly unclear on what
grounds.
You are perfectly entitled to the opinion that C#, Perl, and Rust are
wrong in their usage of the term, but they absolutely use that term in
the same way as Hack, not in the way you wish to define it.
That is why there is an empty line between the pages that are actually
documenting the usage of an annotation functionality and the pages that
are using the term annotation correctly in natural language to describe
something. Again, it is about language and terminology.
OK, I'm completely lost now. I thought your argument was that the
feature should under no circumstances be called "attributes", because
that is too general a term, and that it should instead be called
"annotations", because that is the only correct term. Then you link to a
page which demonstrates annotations being used as a general term, and
attributes being used for the feature being proposed.
Me neither, I am saying that the term is too generic and that we should
use the term annotation in order to make it unique, easily
understandable, non-ambiguous in terms of natural language and not in
terms of what others use or do.
Except that the Rust example demonstrates that "annotation" can be used
just as generically and ambiguously as "attribute". There really is very
little to choose between the two terms.
Regards,
Rowan Collins
[IMSoP]
I meant specifically in the context of C#/.net. You claimed a very
specific usage within that framework, but all the articles I can find
refer to them consistently as "attributes" in that context. Event the
Wikipedia article:In the C# programming language, attributes are [...] equivalent to
annotations in Java.That's pretty clear to me that the two languages call the same concept
different things.
Erm, actually I did not claim anything and applied proper terminology to
the C# syntax. However, if it is so important for you to stick with C#
and .NET then let's do this.
I previously claimed that Microsoft does a perfect job. That claim was
based on the fact that the feature is called "Data Annotations" and that
one can apply and create custom "Attributes" (Metadata). [1] I still
stand to that claim because this is exactly how the computer science
terminology defines these terms.
We can easily add validation to our application by adding Data
Annotations to our model classes. Data Annotations allow us to
describe the rules we want applied to our model properties, [...]
http://www.asp.net/mvc/overview/older-versions/mvc-music-store/mvc-music-store-part-6
When you use the Data Annotations Model Binder, you use validator
attributes to perform validation.
That being said, others are not so nice to Microsoft and directly call
the usage of the term "Attributes" in this context a MINFU because they
should call it "Annotations". [2]
We already know from various sources (see initial message) that
attributes are more generally just metadata. Hence, I do not agree that
the usage of the term "Attribute" in the context Microsoft uses it is a
MINFU. One simply should not look at the term outside of the
extension/library/namespace "Data Annotations" and everything is fine.
The fact that .NET documentation is most of the time only talking about
"Attributes" is because the documentation explains those classes and
their usage. I do not understand why this means for you that the whole
feature is called attributes.
The word construct "attribute specification" is completely right, it
specifies which attribute should be applied to the data.But it completely disagrees with your earlier claim that "The result of
an annotation is an attribute." There is absolutely no usage of
"annotation" in that page; there is just a description of syntax for
applying "attributes".
You need to keep in mind that they are talking about "Data Annotation
Attributes" in all of the documentation.
It may make sense, but can you point me to any C#/.net documentation
which describes that relationship? I'm talking about actual usage here,
not theoretical definitions.
I am sorry but this is about theoretical definition and not about some
company chose to call it. Actually I am arguing against blindly
following these companies (Facebook and/or Microsoft) and complying with
the theoretical definitions.
As I said in the initial message, using the term /attribute/ is pretty
much never wrong because the term /attribute/ is so generic. :PWhat kind of answer is that? The page clearly describes a Perl feature
very similar to the feature proposed for PHP, and it very clearly calls
it "attributes". If it's "never wrong" for Perl, surely it's "never
wrong" for PHP either?
Notice the :P at the end of the sentence. Usage of the term /attribute/
standalone is pretty much never wrong but always endlessly ambiguous and
that is exactly the problem!
I have already pointed out that 3 of those links do not back up your
claim. You appear to dispute this, but I'm increasingly unclear on what
grounds.You are perfectly entitled to the opinion that C#, Perl, and Rust are
wrong in their usage of the term, but they absolutely use that term in
the same way as Hack, not in the way you wish to define it.
I already went into more detail regarding C#/.NET at the beginning.
As I wrote in the initial message regarding Perl. If the linked feature
is the only way to add attributes than naming it attributes
(standalone) is fine. However, if there are other means than same logic
applies.
I really do not understand why the usage of the term annotation is wrong
in the Rust example. It is a hint for the compiler that can be added by
the programmer or the compiler. That's pretty much a perfect usage
according to the definition of an annotation.
Extra information associated with a particular point in a document or
program. Annotations may be added either by a compiler or by the
programmer. They are not usually essential to the correct function of
the program but give hints to improve performance.
OK, I'm completely lost now. I thought your argument was that the
feature should under no circumstances be called "attributes", because
that is too general a term, and that it should instead be called
"annotations", because that is the only correct term. Then you link to a
page which demonstrates annotations being used as a general term, and
attributes being used for the feature being proposed.
C#/.NET calls them "Data Annotation Attributes" and not "Attributes"
(see above).
Perl does but I am still not sure if it is wrong or right in their
context and included an /if/ in my initial review of their usage of the
word. In case of doubt it's wrong I guess.
Hack definitely uses it wrong.
Also note that the current Attributes proposal is in some way closer to
"Attribute Grammar" [3] than to annotations. I just hope that we can
make an annotation system out of it and not end up with an attribute
grammar system (or would we have to call it /attribution/ system then).
Except that the Rust example demonstrates that "annotation" can be used
just as generically and ambiguously as "attribute". There really is very
little to choose between the two terms.
Declarations can be annotated with ‘attributes’ in Rust.
That is exactly the definition I gave in the initial message. There is
no annotation system in Rust:
Currently, you are not allowed to create your own attributes, the
Rust compiler defines them.
I am repeating myself but:
@deprecated function f() {}
We annotated (@
) the function /f/ with the deprecated
attribute,
hence, deprecated is now an attribute of function /f/ because we
annotated it.
Allows use of the #[start] attribute, which changes the entry point
into a Rust program. This capability, especially the signature for
the annotated function, is subject to change.
The past and current RFCs are not proposing any attributes, they are
proposing a system to annotate data with custom attributes.
[1] http://dataannotationsextensions.org/
[2] https://www.it-visions.de/glossar/alle/454/MetaAttribut.aspx (German)
[3] https://en.wikipedia.org/wiki/Attribute_grammar
--
Richard "Fleshgrinder" Fussenegger
Erm, actually I did not claim anything [...] I previously claimed that Microsoft does a perfect job.
Just thought I'd point out this contradiction.
That claim was based on the fact that the feature is called "Data Annotations" and that
one can apply and create custom "Attributes" (Metadata).
It seems to me that "Data Annotations" are one particular use of a
language feature which is called "attributes". Looking through the list
of descendants of the base Attribute class [1], I can see lots of
different usages, most of which don't refer to "annotations" anywhere
that I can see, only to "applying the attribute". This is true even in
prose introductions such "Controlling XML Serialization Using
Attributes" [2] which has sentences like "Attributes can be used to
control the XML serialization of an object or to create an alternate XML
stream from the same set of classes." and "By applying a
XmlArrayAttribute, you can change the name of the XML element, as follows."
[1] https://msdn.microsoft.com/en-us/library/system.attribute.aspx
[2] https://msdn.microsoft.com/en-us/library/2baksw0z.aspx
One simply should not look at the term outside of the
extension/library/namespace "Data Annotations" and everything is fine.
Why should we not look outside that namespace? What about that namespace
makes it so special?
If we transpose that logic to PHP, are you saying that it's OK for
php.net to refer to "attributes" to discuss the feature, as long as
Doctrine carries on using "annotations" for its usage of that feature?
The fact that .NET documentation is most of the time only talking about
"Attributes" is because the documentation explains those classes and
their usage.
Which classes?
I do not understand why this means for you that the whole
feature is called attributes.
Because the documentation talking about the feature calls it that.
Repeatedly.
"The common language runtime allows you to add keyword-like descriptive
declarations, called attributes..."
https://msdn.microsoft.com/en-us/library/5x6cd29c.aspx
"Apply the attribute to the code element by placing it immediately
before the element."
https://msdn.microsoft.com/en-us/library/bfz783fz.aspx
"Attributes provide a powerful method of associating metadata, or
declarative information, with code..."
https://msdn.microsoft.com/en-us/library/z0w1kczw.aspx
Helpfully, Microsoft make the C# Language Specification readily
available, so I downloaded that
[https://www.microsoft.com/en-us/download/details.aspx?id=7029]
The word "annotation" is used in only one context: "variance
annotations", which are the "in" and "out" keywords that allow a Generic
type parameter to be co- or contra-variant, and nothing to do with the
feature we are discussing. The word "annotate" is also used in reference
to documentation comments, and in the following sentence:
When an optional parameter is annotated with one of the caller info
attributes, omitting the corresponding argument in a call does not
necessarily cause the default parameter value to be substituted.
As far as I can see, it's not being used as a specific term in that
sentence, and you could safely substitute "is marked with".
"Attribute" meanwhile appears 19 times in the Table of Contents, all
describing the feature we are discussing - the ability to add some
syntax next to some code to apply metadata retrievable by reflection.
The Appendix contains a set of grammar constructions for the grammar of
the "[ Foo (Bar) ]" syntax used to apply attributes; the grammar rules
all use the word "attribute", never "annotation".
I am sorry but this is about theoretical definition and not about some
company chose to call it. Actually I am arguing against blindly
following these companies (Facebook and/or Microsoft) and complying with
the theoretical definitions.
Language is a funny thing: words mean what they mean because we agree on
that meaning, and understand each other when we use it. A "theoretical
definition" is no use at all if it's not how people actually use a word.
Computer Science terms are doubly-cursed here, because rather than
coining new words, we tend to stretch metaphorical use of existing terms
from other fields, even when those fields overlap with our own.
If a language as popular and influential as C# calls this feature
"attributes", as I hope I've demonstrated it does, then it's hard to say
that that's the "wrong" name - it is the name everybody in that
community uses, and they all agree and understand its meaning.
As I wrote in the initial message regarding Perl. If the linked feature
is the only way to add attributes than naming it attributes
(standalone) is fine. However, if there are other means than same logic
applies.
I still don't really understand what you mean by this. As far as I can
see, the feature in Perl is exactly equivalent to the one proposed for
PHP. Do you mean there is something in PHP which you consider to have
prior claim to the word "attributes"?
I really do not understand why the usage of the term annotation is wrong
in the Rust example. It is a hint for the compiler that can be added by
the programmer or the compiler. That's pretty much a perfect usage
according to the definition of an annotation.
I didn't say it was "wrong", I said it showed that "annotation" is just
as ambiguous a term as "attribute". Pretty much any syntax can be
referred to as an "annotation" (see the C# "in"/"out" example earlier),
just as pretty much any modifier or property can be referred to as an
"attribute". So in an ideal world, we wouldn't use either term if we
wanted to unambiguously refer to a new feature. At best, the Rust
example is irrelevant to the discussion; at worst, it weakens the case
for "annotation" being an unambiguous term, which I thought was part of
your argument.
The past and current RFCs are not proposing any attributes, they are
proposing a system to annotate data with custom attributes.
Absolutely! But all we're deciding is what the language will call the
overall feature - what page it will be on in the manual, what word will
be used in the error messages, etc. In some languages, like Java, those
resources would refer to "Annotations"; in other languages, like C#,
those resources would refer to "Attributes".
Both terms have advantages and disadvantages, precedents and
connotations - and both have potential ambiguities with other uses of
the normal English words that have been borrowed. In the end, it really
is mostly a matter of taste.
Regards,
--
Rowan Collins
[IMSoP]
Just thought I'd point out this contradiction.
It seems to me that "Data Annotations" are one particular use of a
language feature which is called "attributes". Looking through the list
of descendants of the base Attribute class [1], I can see lots of
different usages, most of which don't refer to "annotations" anywhere
that I can see, only to "applying the attribute". This is true even in
prose introductions such "Controlling XML Serialization Using
Attributes" [2] which has sentences like "Attributes can be used to
control the XML serialization of an object or to create an alternate XML
stream from the same set of classes." and "By applying a
XmlArrayAttribute, you can change the name of the XML element, as follows."
I guess I am wrong then at it truly is MINFU as others claim.
Why should we not look outside that namespace? What about that namespace
makes it so special?If we transpose that logic to PHP, are you saying that it's OK for
php.net to refer to "attributes" to discuss the feature, as long as
Doctrine carries on using "annotations" for its usage of that feature?
Annotations are generally ignored by the compiler but are retrievable
via reflection at runtime:
Unlike comments, annotations are reflective in that they are embedded
in the files generated by the compiler and may be retrievable at
run-time.
metadata added to a document or program
While attributes are part of the actual program, we already had public,
protected, and private but there are many more like final, abstract,
static and properties of objects are also commonly called attributes.
An option or setting belonging to some object.
A semantic item with which a method or other code element may be
decorated.Properties can /be/ marked as obsolete with an attribute, which will
cause the compiler to generate a warning if they are used.
Class member variables are called "properties". You may also see them
referred to using other terms such as "attributes" or "fields", but
for the purposes of this reference we will use "properties".
Language is a funny thing: words mean what they mean because we agree on
that meaning, and understand each other when we use it. A "theoretical
definition" is no use at all if it's not how people actually use a word.
Computer Science terms are doubly-cursed here, because rather than
coining new words, we tend to stretch metaphorical use of existing terms
from other fields, even when those fields overlap with our own.If a language as popular and influential as C# calls this feature
"attributes", as I hope I've demonstrated it does, then it's hard to say
that that's the "wrong" name - it is the name everybody in that
community uses, and they all agree and understand its meaning.
That is why we use dictionaries.
I still don't really understand what you mean by this. As far as I can
see, the feature in Perl is exactly equivalent to the one proposed for
PHP. Do you mean there is something in PHP which you consider to have
prior claim to the word "attributes"?
Yes and I explained it multiple times already: public, protected,
private, final, abstract, static, ... all of them are attributes that
are applied by the compiler to alter data and they are reflective.
However, one could argue that the properties themselves are attributes.
That is what Sebastian Bergman complained about with the term. It is
simply too ambiguous and he is correct there.
Hence, it is better to talk about public, protected, and private solely
as /access modifiers/ and final, abstract, and static simply as
/keywords/. The latter might be a very broad term but it is at least
unambiguous: http://onelook.com/?w=keyword&ls=a
I didn't say it was "wrong", I said it showed that "annotation" is just
as ambiguous a term as "attribute". Pretty much any syntax can be
referred to as an "annotation" (see the C# "in"/"out" example earlier),
just as pretty much any modifier or property can be referred to as an
"attribute". So in an ideal world, we wouldn't use either term if we
wanted to unambiguously refer to a new feature. At best, the Rust
example is irrelevant to the discussion; at worst, it weakens the case
for "annotation" being an unambiguous term, which I thought was part of
your argument.
I disagree in the context of programming. There are multiple
dictionaries available (and linked in this thread) that define the term
over and over again in the same manner. However, the term attribute
changes its meaning based on context.
Absolutely! But all we're deciding is what the language will call the
overall feature - what page it will be on in the manual, what word will
be used in the error messages, etc. In some languages, like Java, those
resources would refer to "Annotations"; in other languages, like C#,
those resources would refer to "Attributes".Both terms have advantages and disadvantages, precedents and
connotations - and both have potential ambiguities with other uses of
the normal English words that have been borrowed. In the end, it really
is mostly a matter of taste.
Very true but the last sentence is not in my book; maybe in .NET, Perl,
and Hack.
I guess we can summarize:
-
.NET world, Perl, and Hack are different than others.
-
Rust is complicated and is definitely different than others.
-
All others use the term according to most/all dictionaries.
-
Richard thinks annotations is the correct term. [1]
-
Rowan likes annotations but thinks attributes are equally suited.
I can live with that. Anyone can read our discussion and make up their
mind on their own (and hopefully share it with us).
[1] Unless of course---and I wrote that before---we extend the name of
the new functionality to be more precise:
- Attribute Grammar (what the current proposal effectively is)
- Meta-Attributes
- Custom Attributes
- Annotation Attributes
- Aspects [2]
- ...
[2] https://en.wiktionary.org/wiki/aspect
In aspect-oriented programming, a feature or component that can be
applied to parts of a program independent of any inheritance
hierarchy.
--
Richard "Fleshgrinder" Fussenegger
Both terms have advantages and disadvantages, precedents and
connotations - and both have potential ambiguities with other uses of
the normal English words that have been borrowed. In the end, it really
is mostly a matter of taste.Very true but the last sentence is not in my book; maybe in .NET, Perl,
and Hack.I guess we can summarize:
.NET world, Perl, and Hack are different than others.
Rust is complicated and is definitely different than others.
All others use the term according to most/all dictionaries.
Richard thinks annotations is the correct term. [1]
Rowan likes annotations but thinks attributes are equally suited.
I can live with that. Anyone can read our discussion and make up their
mind on their own (and hopefully share it with us).
My own 'working process' has always looked at annotation as the block of
tags being added to an object. Then calling some elements of the
annotation 'attributes' just dovetails in, just as other annotation may
highlight access control or authorship. I've never though as the whole
lot as individual attributes.
[1] Unless of course---and I wrote that before---we extend the name of
the new functionality to be more precise:
- Attribute Grammar (what the current proposal effectively is)
- Meta-Attributes
- Custom Attributes
- Annotation Attributes
- Aspects [2]
- ...
Which simply highlights a working practice we have been following since
docBloc annotation started?
What IS now making a lot more sense to me is the way things that I've
followed the practices inherited from the original PHP4 code have been
morphed into things like 'reflections'. I still don't see the entire
need for this layer of complexity, and the Drupal comment that they
don't use them makes sense since their code base pre-dates the need and
uses 'more traditional' methods to provide the same results? If you have
never had the need for reflections adding their use is a strain.
If a variable is public, but should only be accessible via other
functions such as getter and setter then the underlying value variable
needs to be private? So if all the values are private and wrapped in
code, then any value can be extended to also provide additional metadata?
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk