Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92683 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99108 invoked from network); 24 Apr 2016 11:49:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2016 11:49:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.87 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.87 mx106.easyname.com Received: from [77.244.243.87] ([77.244.243.87:33817] helo=mx201.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/02-21220-BA2BC175 for ; Sun, 24 Apr 2016 07:49:00 -0400 Received: from cable-81-173-133-226.netcologne.de ([81.173.133.226] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1auIX2-0005RL-8r; Sun, 24 Apr 2016 11:48:56 +0000 Reply-To: internals@lists.php.net References: <571C8E3B.3010105@php.net> To: Zeev Suraski , Sebastian Bergmann Cc: "internals@lists.php.net" Message-ID: <571CB29D.8040208@fleshgrinder.com> Date: Sun, 24 Apr 2016 13:48:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vrvrRSHHxDVGcja0xbGSe5EOjI4L5GpwF" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: php@fleshgrinder.com (Fleshgrinder) --vrvrRSHHxDVGcja0xbGSe5EOjI4L5GpwF Content-Type: multipart/mixed; boundary="ofIw2qNGallvToGidHK59AlTeGivlLBWT" From: Fleshgrinder Reply-To: internals@lists.php.net To: Zeev Suraski , Sebastian Bergmann Cc: "internals@lists.php.net" Message-ID: <571CB29D.8040208@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] PHP Attributes References: <571C8E3B.3010105@php.net> In-Reply-To: --ofIw2qNGallvToGidHK59AlTeGivlLBWT Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 4/24/2016 1:00 PM, Zeev Suraski wrote: >=20 >=20 >> -----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 annotatio= n. >> >> Dmitry, >> >> please use "annotation" as the name for this feature and not "attribut= e". >> >> 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 cor= rect >> term for them (AFAIK) is "attribute". >=20 > I don't think I've ever heard properties referred to as attributes in t= he context of PHP. The PHP manual defines them and refers to them throug= hout as 'properties'. >=20 > (I'm not voicing an opinion on attributes vs. annotations; Just pointi= ng out that data storage inside objects isn't named attributes). >=20 > Zeev >=20 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 use= rs. `$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. --=20 Richard "Fleshgrinder" Fussenegger --ofIw2qNGallvToGidHK59AlTeGivlLBWT-- --vrvrRSHHxDVGcja0xbGSe5EOjI4L5GpwF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXHLKjAAoJEOKkKcqFPVVr5cEQAIOg2oPEAMqaFq7vKRpnmzOO mjfDhG+ZuzvOmxTCSP3mAZwK/g2tQbVvzwZzwzD/DFbBvaGiZ9EQw2Io6Mo8UvLG MV8rJNHvLR1eXAOS7DrwddnTdwYrTprkmfVaVhkY/NPpa3jzNBiGvbIsie9R9Tpj xKKytBJVP4sURem076Aiddiqd/TZzlFQnDOlUE9HnhM5A//pkPx2K6Se2dOL7kDr 7yjAzbpevQ06epKbqKJ7u/HwrsvmjMt5CU38RsDzONTXIbujLDPV040FFs/Zkp97 ap7ruso7LyJ4GoG7q87Gm+mVkQ182xagI1NbBNg+3pwTdW2+7i5iZKIdQp1Cm/vL SPL1Q1GCcBbyDFnwHooV9jovMi5S5LcNu8c5LeOhXL3DBCc6QIqjJNzusR427fyT 0M6GSb6y0NkxOLoO4RnCa9tYRMwenulSJKQzu4flJwYgIjx80LVBroqyfecFBeEH 9oI7xtG2XHxGX1x1GmxmbNcZ4Jt78h0dirwjv+IusqiFaQSfO7ulxsfijCPqav8Y RGExDq67uANqLzp6gNirW4/TargIbtSBeaAcTKkk8qwbAsYo5ebFPNsvv6yNfxOu Lo4LIcSRAhkWyeBhIR7ITDB+zouihE09ihs6GFXlSjOgzTthmi7d3P3bNf+Sd1TT jT/JR/Qtx6U5aOql6aq2 =Vqa6 -----END PGP SIGNATURE----- --vrvrRSHHxDVGcja0xbGSe5EOjI4L5GpwF--