On Fri, 23 Aug 2024, at 12:29, Mike Schinkel wrote: > namespace \AcmeComponents\SplineReticulator\Utilities\Text > > function Foo():int { > return Text\strlen("Hello World"); > } > > The above of course could result in BC breaks IF there happened to be > existing code that referenced Text\strlen() where Text was a top-level > namespace
It wouldn't be a top-level namespace that would cause a conflict, but a nested one: currently the above code resolves the function name as "AcmeComponents\SplineReticulator\Utilities\Text\Text\strlen" (note the "...\Text\Text\..."). It's an interesting suggestion, but I'm not totally sold on "use the end of the current namespace" being easier to remember than "use this symbol or keyword". return namespace\strlen("Hello World"); # current syntax, rather long and unclear return _\strlen("Hello World"); # short, but maybe a bit cryptic return Text\strlen("Hello World"); # variable length, relies on current context return NS\strlen("Hello World"); # shortening of current keyword return self\strlen("Hello World"); # maybe confusing to reuse a keyword? return current\strlen("Hello World"); # clear, but a bit long -- Rowan Tommins [IMSoP]