Re: [Vote] Partial Function Application
| From: | Alexandru Pătrănescu | Date: | Thu, 01 Jul 2021 14:00:31 +0000 |
| Subject: | Re: [Vote] Partial Function Application | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115254@lists.php.net to get a copy of this message | ||
On Thu, Jul 1, 2021 at 3:05 PM Hamza Ahmad <office.hamzaahmad@gmail.com>
wrote:
> Hi all,
>
> While I was reading through the discussion, I found a question related
> to the conflict of constant names and functions names. In other words,
>
strlen can be both a constant name and a function name.
>
This was stated before but, basically, the idea is that the difference
between a constant and function or between the property and the method (or
class constant and static method) is done on the usage side, if a calling
syntax is encountered.
$a = strlen; // reading the constant
$a = strlen(); // calling the function
$a = $this->run; // reading the property
$a = $this->run(); // calling the method
$a = Clazz::operation; // reading the static property (or enum case)
$a = Clazz::operation(); // calling the static method
This way of identifying it is something embedded in the language and
probably not that easy to avoid.
This is why the syntax is similar to a method call, to properly identify
the callable without other new syntax.
Alex