Re: RFC: short and inner classes
| From: | Iliya Miroslavov Iliev | Date: | Sun, 16 Mar 2025 21:21:35 +0000 |
| Subject: | Re: RFC: short and inner classes | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126796@lists.php.net to get a copy of this message | ||
Claude, exactly! By using '::' you cannot distinguish between a class and a
function. So this is not an option because it leads to a headache. Just my
2 cents
On Sun, Mar 16, 2025 at 11:08 PM Claude Pache <claude.pache@gmail.com>
wrote:
>
>
> Le 15 mars 2025 à 12:53, Rowan Tommins [IMSoP] <imsop.php@rwec.co.uk> a
> écrit :
>
>
>
> On 14 March 2025 23:37:08 GMT, Rob Landers <rob@bottled.codes> wrote:
>
> I could get behind
::, but I feel that it introduces human
> ambiguity. I
> don't believe it would introduce compiler ambiguity, but as a human, I have
> to hope the programmers are using a style that makes it obvious what are
> inner classes and what are constants/methods.
>
>
> As far as I can see, all four languages I looked up last night (Java, C#,
> Swift, Kotlin) use the same syntax for accessing a nested type as for
> accessing a property or method, so we'd be following the crowd to use "::"
>
> That said, I think they all also use that same syntax for namespace (or
> equivalent) lookups, so the same argument can be made for "\". (Why PHP
> separates those isn't entirely clear to me.)
>
>
> According to my archeological research, it was originally designed to
> reuse :: as namespace separator, but it was finally changed to
> something
> else due to ambiguity between static class elements and namespaced
> functions/constants. See
> https://wiki.php.net/rfc/namespaceissues and
> https://wiki.php.net/rfc/backslashnamespaces (where (¢~ ²�:î]³
> =«„:: is assumed to be
> the namespace separator).
>
> —Claude
>
--
Iliya Miroslavov Iliev
i.miroslavov@gmail.com