Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Desired namespace behavoir [RSS Feed]

#1 Nov. 30, 2005 07:56:15

Bob S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Desired namespace behavoir


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

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Desired namespace behavoir [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support