From: Jost B. <jos...@ya...> - 2005-12-13 18:38:57
|
Hi Mark, the syntax for namspace access is different than the syntax for property access. For example if you have a class public interface php { public interface java { public class bridge { public enum JavaBridge = {UNITS, VOLUME, SCORE}; } } } the JavaBridge would be accessed via: $bridge = new JavaClass('php$java$bridge$JavaBridge'); echo $bridge->UNITS; this is to avoid name clashes with the class: $bridge = new JavaClass("php.java.bridge.JavaBridge"); The different syntax makes sense, an I hope the PHP6 developers don't make the same mistake that sun made; if you compile and place the above php.class into your classpath, then no java developer can access the class php.java.bridge.JavaBridge anymore because the java compiler automatically rewrites the syntax php.java.bridge.JavaBridge into php$java$bridge$JavaBridge and stores this into the .class file. However, the real fun begins if you compile and place the following java.class into your classpath: public interface java { public class lang { public enum String = {one, two}; } } After that a new java.lang.String() will return the above enum. -- But I guess this problem is caught by the java bytecode verifier... Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |