> Le 15 mars 2025 à 12:53, Rowan Tommins [IMSoP] <[email protected]> a écrit :
>
>
>
> On 14 March 2025 23:37:08 GMT, Rob Landers <[email protected]> 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