"Stan Vassilev | FM" wrote:

> For me the only way to make it clear to both humans and parsers alike is
> the filepath semantics, in all places, including use. It's not perfect,
> there's no completely problem-free solution, but "prepend \ for absolute
> path" is able to become muscle memory, while other mixed solutions I've
> seen are more confusing and require more thinking: "wait in this context
> what was what?".

My point exactly. This was a real pain in the ass while converting from old
to new resolution rules (though I now this is a one-time example).

However i was explaining the new resolution rules to my co-workers recently 
and it was aparent the context dependant resolution isn't clear, while 
understanding: "it's always relative to current namespace" is simple and 
easy. Also most people are familiar with filepath semantics so there is a 
obvious point of reference (and confusion when it's not consistent).


> But this introduces a new keyword: nameof, which could clash with
> function/class/constant "nameof" in existing source code. I could suggest
[...]
> But it's definitely in-your-face issue while using namespaced code.

I'm not shure how big of a problem "nameof" clashing would be, however a way 
to get fully qualified name is a nessesity in my opinion - i strugle with 
this in my framework too. 

Gregs suggestion of __NAMESPACE__ concatenated solution (if i understand it 
correctly) isn't one accualy because __NAMESPACE__ resolves to current 
namespace; and "typeof" might (and probably usually will) be used on aliased 
classes not nessecerely from current namespace.

m.


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to