Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94316 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98739 invoked from network); 28 Jun 2016 21:20:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2016 21:20:09 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wm0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:36321] helo=mail-wm0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/01-25084-90AE2775 for ; Tue, 28 Jun 2016 17:20:09 -0400 Received: by mail-wm0-f42.google.com with SMTP id f126so156245878wma.1 for ; Tue, 28 Jun 2016 14:20:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:from:date:to:message-id; bh=sKU0tOs6uDzl4Snhqt90diDnVEARA0reC3+UlYe5BYc=; b=XSNcywDrg7IsrhdGQM7iHTHohcC06Rrv4Od/imc91iQVljzpOyiYtF0PclzmNRH6B7 +8aUDxp7KbbQpDHLIzevQPqhSUdR1pkv1yFTn0rmAkytR0xE74vXXPOfiU7bb+xV7p1l 2lxNzfcdY/uXtS5dFqK6d85Yl+QtK8an464j01Yjnj55rbWpnPqz6ilvTODmoRxSIlEn QqZWjmWzFysF6zAiaT+A8oK3ygbEdmjTIxClVRVIE0KK4zUXqe36Lhs3pGXOn+N5U3By dZndnzFe328RN9XACbIHGHsXGVW+dkQpMYN5g0wzHlx9RX7HUNbrzKL60QzjL5m7y4IX XOow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:from:date:to:message-id; bh=sKU0tOs6uDzl4Snhqt90diDnVEARA0reC3+UlYe5BYc=; b=Sh0tsXE043ARImrxDO9fmbCzOT3/uiBxPKTW0ofa5pxnBMsrDwRS15BkWlBRN6R4kh pfCNiAY5Mb6gBJ5/5sQvHuFk4YEjyExqVQlK2DJoeJ0FIXYXszA3s5d0dneUmf9EmVuB Xo/uShH5NmpGOJRl2KPmLAQ7aTBQmYMemnYNsELcNY6/kgHBxo9wxwvnud1c2cG09uEi nFkU2eGpRC/gThqF5DlnHpszM5rrzQk9hhaBBwwvTq8X7ytgHxU3JcuLdD7V5ammBHhx FkkgD7RPYwvf4HizorPcolPU4eoCnHoTlpZ13MyqmHcrI1ZQHLnnoAqxTahLB4pP2aPb MApw== X-Gm-Message-State: ALyK8tLpeBOANouf1x0ERGbtwKLUNBukBMmfr3TUmTTr8PYTqtHX1Pdf0pim9aJsAddVKg== X-Received: by 10.194.145.244 with SMTP id sx20mr5598221wjb.169.1467148806264; Tue, 28 Jun 2016 14:20:06 -0700 (PDT) Received: from android-c0c105534eccd9bf.default ([2.25.96.65]) by smtp.gmail.com with ESMTPSA id f196sm2191784wmg.15.2016.06.28.14.20.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 14:20:04 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <211db59e-9c22-6df4-1f72-66ebbc5095bd@fleshgrinder.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Tue, 28 Jun 2016 22:20:00 +0100 To: PHP internals Message-ID: Subject: Re: [PHP-DEV] [RFC] Simple Annotations From: rowan.collins@gmail.com (Rowan Collins) On 28 June 2016 20:10:15 GMT+01:00, Pedro Cordeiro wrote: >> << HttpMethod::post() >> // equivalent to static method-call >> HttpMethod::post() >> > >What would this, specifically, do? Would it call HttpMethod::post() >when >the class gets instantiated and return its return on a >ReflectionClass::getAnnotations()? Why is it necessary to be able to >evaluate expressions on annotations? I'm not sure if it's definitely necessary, but the stated use case was for factories / named constructors. PHP only has one constructor per class, so it's not uncommon to have static createFromX methods. Since this will eventually evaluate as "new Foo(42)": << Foo(42) >> The idea is that this would be available to call a factory instead: << Foo::fromRoman('XLII') >> The neat thing being that by limiting the options to this, you can still extract a class name for every annotation. I say "eventually", because as proposed, this won't actually happen until you explicitly ask for the "instance" of the annotation. See previous examples. Regards, -- Rowan Collins [IMSoP]