Re: Lambdas assigned to constants. Was PHP Annotations RFC + Patch
| From: | Alexey Zakhlestin | Date: | Sat, 18 Sep 2010 10:47:34 +0000 |
| Subject: | Re: Lambdas assigned to constants. Was PHP Annotations RFC + Patch | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49763@lists.php.net to get a copy of this message | ||
On Thu, Sep 16, 2010 at 10:35 PM, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
>> const foo = function () use ($globalVar) {
>>
>> };
>
> How would you call this thing? foo()? Then you have a problem - foo()
> already has meaning, and it's "call function named foo", not "get constant
> named foo and call function inside if it's there".
His idea is, that "get constant named foo and call function inside if
it's there" should be the only meaning
and "function foo() {}" should be syntactic sugar for defining
constant foo with closure inside.
--
Alexey Zakhlestin
http://www.milkfarmsoft.com/