Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92685 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2305 invoked from network); 24 Apr 2016 11:58:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2016 11:58:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 74.125.82.42 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 74.125.82.42 mail-wm0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:36504] helo=mail-wm0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/B2-21220-3F4BC175 for ; Sun, 24 Apr 2016 07:58:43 -0400 Received: by mail-wm0-f42.google.com with SMTP id v188so67944636wme.1 for ; Sun, 24 Apr 2016 04:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=qWSW8VQ2Z+/P+atGJKK+tBzKnKTt8bbOBtOaVasyvwA=; b=vKoyldkrhQof3FWtQMcy5IrMB7UUzj4LVtTIPVMD57bymNuWvfwr02DdVMFu6NZ642 5gd0KIpvsJytTVFqTXUwjhHfUmv4Q1eZDgftvIJHdKTXiLHWlJB5tOu5a1O/Mn6TJC6l 1jYu1qQozVAJdJGRnm9vs3AgI4SPWZqy10SXOqaCQKjITxoxdZVsq5HCJFwRaEe8uErw BsGMUKMiGNoKbOwQC9FXS5DawsK/0cV10yz5JMQwsFF76jBt8mzt9tdiMRZ2lDD4vUNC +jrad3Tj8d2C3lvBuZsdnEeTwoLUm6Nj7dg1CdfyzkMY5ZcinZvKIndb2VqVMKaeIpEy 9+lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=qWSW8VQ2Z+/P+atGJKK+tBzKnKTt8bbOBtOaVasyvwA=; b=DoHD4uQxldwypYc31w/X6bZK87EdkUIqr2qG4SC4Jc4pfZerQ/eU3F4VbVMvHBZuUX F13IR+RSN2QprwcecRunm2Ku1lG+7K8u5apL7NeZoN/Q0BcNAs0obNJ+xD9KJIsykjZz uE9DPt/L0PC4DuXKtRdAOHAbHd2417kFQIzaCnL9iW/zF8FXcEHqQhiYAy21Fkm0iXg7 OOqAjKzHU+5s1FLy9+clNbqJusSQkvh7drLc4JLoRJqLYOy5a858u4GVF1tJnzM31CxL yIxhatPBe7WbZNvv0JmdOZegxG3usRy/PNr/KME2ZH2//dZWkghvB7lMaJmnWfi4O1IJ pvng== X-Gm-Message-State: AOPr4FWn3Bz1EJNklXCl7fjwZVQXn04N2eAkF/fc9JHa5VGEMgnk7CA9Ix6a2OozMtRXwouN2QNgGOj1AAN+YA== MIME-Version: 1.0 X-Received: by 10.28.168.76 with SMTP id r73mr3972998wme.44.1461499120969; Sun, 24 Apr 2016 04:58:40 -0700 (PDT) Received: by 10.194.94.163 with HTTP; Sun, 24 Apr 2016 04:58:40 -0700 (PDT) X-Originating-IP: [93.129.116.46] In-Reply-To: <571CB29D.8040208@fleshgrinder.com> References: <571C8E3B.3010105@php.net> <571CB29D.8040208@fleshgrinder.com> Date: Sun, 24 Apr 2016 13:58:40 +0200 Message-ID: To: PHP Internals Cc: Zeev Suraski , Sebastian Bergmann Content-Type: multipart/alternative; boundary=001a114ccd56f1fffc053139c74e Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: kontakt@beberlei.de (Benjamin Eberlei) --001a114ccd56f1fffc053139c74e Content-Type: text/plain; charset=UTF-8 On Sun, Apr 24, 2016 at 1:48 PM, Fleshgrinder wrote: > On 4/24/2016 1:00 PM, Zeev Suraski wrote: > > > > > >> -----Original Message----- > >> From: Sebastian Bergmann [mailto:sebastian@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 . 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 > > --001a114ccd56f1fffc053139c74e--