Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32833 invoked from network); 16 May 2016 17:23:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2016 17:23:52 -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:34919] helo=mail-wm0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/38-65275-7220A375 for ; Mon, 16 May 2016 13:23:52 -0400 Received: by mail-wm0-f42.google.com with SMTP id e201so109426908wme.0 for ; Mon, 16 May 2016 10:23:51 -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:cc:message-id; bh=ozCQIulJcE2N9tKZZ5z/SxJLp+F6+/uf+FxAs/lFtNc=; b=Rd+Kt30dwyW4yZQ8SsJ8XHsxOAAz9kKPQABIjfYoCsYMX2NfbvN36gn7Iu34r1+EhM /Kzo+48w255e9JM5O9bvT8KRqZZs0xfxm8iwcVNmn/VcClqncnmVes5I+y+2/0g1Twzs pSU+52WcGzCxgOZS2EMccezQm1c843zsW28p7y3ZShSmeknhJ7NrUCvRPPP8pStWWkOd xrj+vO6kaJtRlR3ZVGag9QuWeQUIezlEQFES9PPxMPIWbYtWpTT4PQeCxV1wF+2GyFsK eBVdW6YD2tYm//E7BO0dPmTGWcHOMb4XQF04lUeYdcRRrO2/mcDePXEaVbeNADRMitAv PyLQ== 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:cc:message-id; bh=ozCQIulJcE2N9tKZZ5z/SxJLp+F6+/uf+FxAs/lFtNc=; b=GJRQvIRDyBuTd+HUVxTzGRVwbW59fFN/TcfmWMzab5muGnMr5N6aYoVBaeEpjSl/ZR QQLHjlYpAuZHiw4mAXYoq6LWXgFba0XNOu3DGw4YpUlbNUkyZhnBWMNlAokVeMu1Zma+ WyjEgEd65vTSpYmuZQZ/v3a7Juy647BSt4AGiy9Jr0Sk6jdXP4Up6bodPrbCi3nhr5L+ u+Q7/9tCFqKNGeaTFFU+46hG6/hw8YIXxxys5rO/+9RCZdmu3e3KJVzKhPue8qwxjCqV ubhuIMA26qslU1jLLudqCNiFEcopSqDWD67xe31WKX8hrrG7M91K45V0gjUSCNQig81a JEVA== X-Gm-Message-State: AOPr4FUMBQoXnKgCLrEWH9RSZBY1sIMu9Un7fuqOIRlsR5AHfM0pzxdPUoLoqo5JZvJyZw== X-Received: by 10.195.11.34 with SMTP id ef2mr30340786wjd.101.1463419428833; Mon, 16 May 2016 10:23:48 -0700 (PDT) Received: from [10.134.44.196] ([213.205.251.224]) by smtp.gmail.com with ESMTPSA id iv1sm34815052wjb.34.2016.05.16.10.23.47 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 May 2016 10:23:48 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <61e6a083-91c2-799f-9757-02f56fe184e9@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----CI6NWP5GR0EUIXDZ7W0RZA3IS4LDR3" Content-Transfer-Encoding: 8bit Date: Mon, 16 May 2016 18:23:44 +0100 To: Rasmus Schultz CC: PHP internals Message-ID: <78C59EA5-3B2B-4BDF-A401-1F3927FCA44E@gmail.com> Subject: Re: [PHP-DEV] [RFC] Simple Annotations From: rowan.collins@gmail.com (Rowan Collins) ------CI6NWP5GR0EUIXDZ7W0RZA3IS4LDR3 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 On 16/05/2016 14:05, Rasmus Schultz wrote: > I'm afraid I don't follow. Why is it a problem to simply add a > function or class to the global namespace? > > << new Memoize() >> > > or maybe a class with factory functions for built-in annotations: > > << Meta::memoize() >> Well, those particular names look quite likely to collide with users' code, though I guess more obviously reserved names could be used. More generally, though, neither feels a natural fit, because of the need to specify a value, rather than a name. On Reflection, what would an instance of class Memoize look like? Could you call "new Memoize" somewhere else? If a memoize() function was executed, what value would it return? Since you can only see the evaluated value, how could you detect the annotation for debugging? Indeed, if we're interested only in values, not where they come from, are the following all equivalent, and the mechanics totally unndetectable by Reflection? <> <<(function(){return null;})()>> function foo() { return null; } << foo() >> If the function form doesn't receive any context, its only purpose would be to copy some runtime global state into the annotation value on first access, which seems like a strange thing to do. > I tend to agree with Richard though, that system directives really > ought to be supported by the language with keywords rather than > annotations. That would be one way around it, indeed, so rather than "Future Scope", you could label "compiler directive" type annotations as "deliberately out of scope". Regards, -- Rowan Collins [IMSoP] ------CI6NWP5GR0EUIXDZ7W0RZA3IS4LDR3--