Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92849 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47889 invoked from network); 27 Apr 2016 20:12:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2016 20:12:10 -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 212.232.25.164 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.164 mx208.easyname.com Received: from [212.232.25.164] ([212.232.25.164:54796] helo=mx208.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/3B-20013-71D11275 for ; Wed, 27 Apr 2016 16:12:08 -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 1avVoY-0005Im-MG; Wed, 27 Apr 2016 20:12:04 +0000 Reply-To: internals@lists.php.net To: php-internals , Dmitry Stogov , Sebastian Bergmann Message-ID: <57211D05.6020002@fleshgrinder.com> Date: Wed, 27 Apr 2016 22:11:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="I6W4xM3L6qMdacnVCxNBRJnooU3sXltuS" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: [RFC] PHP Annotations VS Attributes From: php@fleshgrinder.com (Fleshgrinder) --I6W4xM3L6qMdacnVCxNBRJnooU3sXltuS Content-Type: multipart/mixed; boundary="hUCTuS1Rl07Sl4MkeK3jdUSBMwlUofhx7" From: Fleshgrinder Reply-To: internals@lists.php.net To: php-internals , Dmitry Stogov , Sebastian Bergmann Message-ID: <57211D05.6020002@fleshgrinder.com> Subject: [RFC] PHP Annotations VS Attributes --hUCTuS1Rl07Sl4MkeK3jdUSBMwlUofhx7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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/. On 4/25/2016 10:31 AM, Dmitry Stogov wrote: > 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 > > --- http://www.merriam-webster.com/dictionary/attribute > 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. > > --- https://en.wikipedia.org/wiki/Attribute_%28computing%29 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 =3D 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=3Dattribute&ls=3Da 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=3Dattribute 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://encyclopedia2.thefreedictionary.com/annotation http://www.onelook.com/?w=3Dannotation&ls=3Da The term *annotation* is not only used by Java: https://packagist.org/search/?q=3Dannotation 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.ht= ml https://www.dartlang.org/effective-dart/style/ =2E.. https://rubygems.org/search?utf8=3D%E2%9C%93&query=3Dannotation http://rustbyexample.com/scope/lifetime/explicit.html https://www.google.de/search?q=3Djavascript+annotation =2E.. 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. :) --=20 Richard "Fleshgrinder" Fussenegger --hUCTuS1Rl07Sl4MkeK3jdUSBMwlUofhx7-- --I6W4xM3L6qMdacnVCxNBRJnooU3sXltuS 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 iQIcBAEBCAAGBQJXIR0JAAoJEOKkKcqFPVVr0vkP/0wxecx0zII3eFXzJJItvVO9 Rc69YWCg8vaB1l0FjY12SlUg2e9Hfni2xRSW/usMyhJ/Up89yKvmflysUswqZMAH ijBur+IALwPbDtELZ97mLfHK6onjpqUIbosVHxdXClVxk38fCiIRDcsu4Kbqk15J zZ8pD+2Vx7ReKgWU55sPgW6UbqyZM1zd1MZsUBMiIiU1O7cNJkxCvvjRgT3sPA0F rSiGX5dgrgcb6hUt0rUK9cOKEYiU+Snw/KZFpRbRsS8hjwA/jAf0ub/W3pfDDe9C zmA/nMwF7psKxc9PfCW+kE1ptJS0hJ/neom6TcbRQfI6gkobBQ4mEsrnnrGQ0yjy EVbgxmQ1o/SmOCx22NlM96vSoJqUI7NWptGaA1gHf5ufpTT7Js3xfHZisRkim8II sz9L/opdoqP0xf4OHCOSng6H/tCpclU9GCSFIKmEfsQq9GH5pyQqonRWdz4CPB6X heKLEE6JcjTP02guNElqYKaok+DvTRDV+DIWX564hor85IkynExeUYOiZQD162Mz n+S4ZOMgGvoeUlJgYCPmKazWDqvjmLnSxzARojYYuO8MNoWBHr0Za6Uq2XHdA83q 7DMLgKkFQhALBr3qwX0Y9AdcwdOb3Y++Vjn6ztexAUUCAJBU6LC3dvhZsc6lmOLI W4DH1NvqaSR9jwKk9ore =Cada -----END PGP SIGNATURE----- --I6W4xM3L6qMdacnVCxNBRJnooU3sXltuS--