Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92691 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13165 invoked from network); 24 Apr 2016 13:02:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2016 13:02:36 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.84 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.84 mx103.easyname.com Received: from [77.244.243.84] ([77.244.243.84:39224] helo=mx202.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4C/E4-21220-AE3CC175 for ; Sun, 24 Apr 2016 09:02:34 -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 1auJgF-0001Qw-8L; Sun, 24 Apr 2016 13:02:31 +0000 Reply-To: internals@lists.php.net References: <571C8E3B.3010105@php.net> <571CB29D.8040208@fleshgrinder.com> <571CBA5D.4020905@fleshgrinder.com> <571CC222.1050205@fleshgrinder.com> To: Benjamin Eberlei , PHP Internals Cc: Zeev Suraski , Sebastian Bergmann Message-ID: <571CC3DF.7090602@fleshgrinder.com> Date: Sun, 24 Apr 2016 15:02:23 +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: <571CC222.1050205@fleshgrinder.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lh0u8g3J9gSaw4h1isSUdn24gUaOFqq5m" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: php@fleshgrinder.com (Fleshgrinder) --lh0u8g3J9gSaw4h1isSUdn24gUaOFqq5m Content-Type: multipart/mixed; boundary="FsEVv9k6gFMcNw9t9g4hshLkr1HUdNHTq" From: Fleshgrinder Reply-To: internals@lists.php.net To: Benjamin Eberlei , PHP Internals Cc: Zeev Suraski , Sebastian Bergmann Message-ID: <571CC3DF.7090602@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] PHP Attributes References: <571C8E3B.3010105@php.net> <571CB29D.8040208@fleshgrinder.com> <571CBA5D.4020905@fleshgrinder.com> <571CC222.1050205@fleshgrinder.com> In-Reply-To: <571CC222.1050205@fleshgrinder.com> --FsEVv9k6gFMcNw9t9g4hshLkr1HUdNHTq Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/24/2016 2:54 PM, Fleshgrinder wrote: > Another way to illustrate what I mean: >=20 > The feature will be used /to annotate/ (add metadata) and the so > /annotated/ data has additional /attributes/ afterwards. >=20 > Trying building the sentence if the feature is called /attributes/. >=20 > @entity > @invariant > final class A { >=20 > @inject > private static $x; >=20 > @test > public memoized function f(){} >=20 > } >=20 > r =3D reflect A > r.getModifiers =3D [ final ] > r.getAnnotations =3D [ entity, invariant ] > r.getAttributes =3D [ final, entity, invariant ] >=20 > r =3D reflect A.x > r.getModifiers =3D [ private, static ] > r.getAnnotations =3D [ inject ] > r.getAttributes =3D [ private, static, inject ] >=20 > r =3D reflect A.f > r.getModifiers =3D [ public, memoized ] > r.getAnnotations =3D [ test ] > r.getAttributes =3D [ public, memoized, test ] >=20 > Note that there are programming languages that allow adding of metadata= > solely via annotations: Ceylon. No matter the data to annotate. Hence, > in Ceylon no differentiation would be made between modifiers and > annotations. However, one could check the actual annotation type to > determine what it is. >=20 > https://modules.ceylon-lang.org/repo/1/ceylon/language/1.2.2/module-doc= /api/index.html#section-annotations >=20 The example isn't actually complete, sorry: @entity @invariant final class A { @inject private static $x =3D 0; @test public memoized function f(){} } r =3D reflect A r.getModifiers =3D [ final ] r.getAnnotations =3D [ entity, invariant ] r.getAttributes =3D [ final, entity, invariant, $x, f() ] r =3D reflect A.x r.getModifiers =3D [ private, static ] r.getAnnotations =3D [ inject ] r.getAttributes =3D [ private, static, inject, value((int) 0) ] r =3D reflect A.f() r.getModifiers =3D [ public, memoized ] r.getAnnotations =3D [ test ] r.getAttributes =3D [ public, memoized, test ] I hope I didn't forgot any attribute. :P All in all, attributes are things that things have to describe those things and annotations allows us to add additional attributes to things, on top of possible other attributes that are already addable by other means (modifiers, values, ...). --=20 Richard "Fleshgrinder" Fussenegger --FsEVv9k6gFMcNw9t9g4hshLkr1HUdNHTq-- --lh0u8g3J9gSaw4h1isSUdn24gUaOFqq5m 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 iQIcBAEBCAAGBQJXHMPjAAoJEOKkKcqFPVVrZ+oP/3se9s6LcTCDcEGPU7ps5Id5 J7IrzRpvqqg1frDqrwpY9n7GEPd9PeyHO86AwXT4RSVgOgPQKAAGFdg1hRVEC3IQ qZJUT8bI/SUJD/PBlJyw5UuyWg1zOhNhzKO/bvGmVTsom3sBFxkXba0UTzyBwvim TJi4KPrQTVUGvfQh/2WDP7e0FcVae3KEAlbLQftRJ1KFxfLFLqNGcgcJ/4Dqar8y ZTPclugVITDnVD5ACmBCPRNq5S6F7TXVQ+7xFKp9RLoCKlEYYPKsL5hdXfmMIg39 NVfEDtD6OlhhG30U7ZO/jUV/6W8XlwuhfB23WrXnMS8W9V/XvsArgTKN4pNiAGrL 4xidVorltFrcCPzlAhx0whL84o3DqQaPKtEGJxXaFnD5+xsljbA58m4XU/VlmxDR 9IAJIep5hiUTwenByFG9+BRlmjiVyao7RQDtvByR8hO24lgb0bSr856jCAVVZcPa l/AMpcHCylDgKOfc/4iSZnOxwlMeUx80fZoe3n4UFiFraW6fXaBaJR3y4oLdX4hz VY7aZUzSdNFVDZlq/KQWijL4damEADjFg/SGnVndecjSKJD85nfSDT4Kd/3h1jrG hINOWix/21+3xSqG59ElbBXaKKp4EXZ16QjOfypkQoaHOKxvVBTC6U1XhFmtEufa v7KkShGCfSXFMJfqkfMu =dj6P -----END PGP SIGNATURE----- --lh0u8g3J9gSaw4h1isSUdn24gUaOFqq5m--