On 4/28/2016 11:36 AM, Rowan Collins wrote:
> 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. ;)

On 4/28/2016 11:36 AM, Rowan Collins wrote:
> 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.

https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatypeattribute%28v=vs.95%29.aspx

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.

On 4/28/2016 11:36 AM, Rowan Collins wrote:
> 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 with*all*  attributes that can be set. Hence,
>> this is what attributes really do.
>>
>> http://perldoc.perl.org/attributes.html
> 
> 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.

On 4/28/2016 11:36 AM, Rowan Collins wrote:
> 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,

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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to