Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68779 invoked from network); 28 Apr 2016 18:05:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2016 18:05:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:36976] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/A8-28296-6D052275 for ; Thu, 28 Apr 2016 14:05:11 -0400 Received: by mail-wm0-f49.google.com with SMTP id a17so78666809wme.0 for ; Thu, 28 Apr 2016 11:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=96Yf9fLV6kqS5pUGfBHO5utRgZixiWN74CXVaJQ0yoY=; b=SEsqkYQYML2iKzoCQhkC9oLIME59PxSTlCYbRCU2EByfYdxWfGXgZOg8kMb3TnsvjH myK+2aFszKEjpcZcA/SgT2Kuday3H78bzplmVpUoJRt5hY7IwXdL1Mw/H61sZp6lvWB3 itkg9OKCla9DDkuIPPkgu+6UfIVnVdsK9FQxVcMQaRmBBJpAK+CR8wPV7Rvnlz2iml8W jDKHnNOMgX/DU04KlYCf+eBon3D9x/y3qvikgx1Ba6TpBiwuATxmyjDEkjYH9HyvyksU xBZ0Awd422LPgTm7kZTlXok/DcQzPwEn86v3xewTS9kRB/MeOkquTNRyd/H2ZAsglT75 x7RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=96Yf9fLV6kqS5pUGfBHO5utRgZixiWN74CXVaJQ0yoY=; b=eLXwXlxY2DWxI967L2dZFnHEwS3TaIzCecOYQxQeysfdpWZVVcCEwbLE42x+eEIFEg N9KU4lvbHXyZk1pvX0Az0GATcrFJbNg/R8i9nh1CVAJBQ1oEpJVCUzYmS93lOvdXpcyF uhT9lRSbS2Ycdf1uKpPfonFDzX/b4UneI3DlgmX4mFXUz/Gm2GpuDk/Mtb4LcVDsmI4z nJHR0uODXOwJei9eXBlc333J28EarIcAFhsfFjJu3wBMPeYo9b7JXKIUh05sOqr7vhqn lddzNxEDRN+UlX+yPOHWBNYsNJlXXs9E4TYL7/cIeRm/MF2nRx/PWXTKN3pKhYWGiPn5 oAcg== X-Gm-Message-State: AOPr4FUFEj4iqd/lLhXjVbHbOkQdE3BHyRBSoP4P/lJmcMyyswEiRllq++fYLiVScbbw2A== X-Received: by 10.194.165.226 with SMTP id zb2mr18359989wjb.172.1461866707966; Thu, 28 Apr 2016 11:05:07 -0700 (PDT) Received: from [192.168.0.82] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id gt7sm10814282wjc.1.2016.04.28.11.05.06 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Apr 2016 11:05:07 -0700 (PDT) To: internals@lists.php.net References: <57211D05.6020002@fleshgrinder.com> <57224957.8090504@fleshgrinder.com> Message-ID: <5d8ef1e6-1d08-bf12-b481-4f72af3f6dd9@gmail.com> Date: Thu, 28 Apr 2016 19:02:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <57224957.8090504@fleshgrinder.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] PHP Annotations VS Attributes From: rowan.collins@gmail.com (Rowan Collins) 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]