Re: php7- dropping the $ from the variable name - rfc
| From: | Dmitry Stogov | Date: | Fri, 19 Sep 2008 10:31:13 +0000 |
| Subject: | Re: php7- dropping the $ from the variable name - rfc | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-40563@lists.php.net to get a copy of this message | ||
Alain Williams wrote:
> On Thu, Sep 18, 2008 at 11:30:37AM -0700, Ionut Gabriel Stan wrote:
>
>> Actually, I somehow understand what he wants, considering we'll soon have lambdas and
>> closures. I mean, in case of javascript a variable can hold as well a function as it can hold
>> anything else.
>> Anyway, I don't think this is the case for PHP. I do find it ugly to write
>> $function(), but I guess I'll live with it as I did until now.
>
> So if you drop the '$' the way that you call a function referenced in variable
> 'funref' is not:
>
> $funref()
>
> but
>
> funref()
>
> However: the PHP parser will take that to be a call to a function named 'funref'.
> So you need to change the syntax to, perhaps, something like C:
>
> (funref)()
>
> I can't see people understanding that.
> Stick with what we have.
>
There is no difference between a function and a variable which holds a
closure in many languages (e.q. JavaScript, LUA, ...), so you don't need
any extra syntax rules.
function foo() {
}
foo();
var bar = function() {
}
bar();
It's not possible to make the same unification with PHP's $, however I
don't see a way to remove $.
Thanks. Dmitry.