Desired namespace behavoir

From: Date: Wed, 30 Nov 2005 07:53:25 +0000
Subject: Desired namespace behavoir
Groups: php.internals 
Request: Send a blank email to internals+get-20874@lists.php.net to get a copy of this message
Looking for some feedback on what the expected behavior should be for class and/or constant ambiguity within namespaces. For instance: Classes.php: namespace A { const FOO = 123; class Bar { . } class FooBaz { . } } namespace B { const FOO = 456; class Bar { . } class FooBar { . } } class Bar { . } define('FOO', 789); File.php: import namespace A; import namespace B; $c = new Bar(FOO); // ambiguous classname/constant Compile-time error on namespace B import? Or runtime error on ambiguous class creation? Jessie, how does your patch handle it? Looking at the modules patch, it appears to be a compile time error when the second class is defined since it is based on zend_class_entry and CG(class_tables). Also, neither patch has scoped imports, they are global. Is this the "preferred" method? Maybe it's the only method, not sure yet, still scratching the surface here. Bob

« previous php.internals (#20874) next »