You´re right, sorry about the final attributes. I´m developing an IDL2PHP5 mapping specification and a compiler. To be full CORBA 2.3 aligned, I´m using Java IDL mapping specification as a base for the PHP IDL specification.
CORBA Enums can be mapped as constants (like Universe extension) or classes (like Java specification). Since PHP5 offers type hinting, type safe will be done at engine level with classes. So the mapping would be something like this: // generated PHP final class <enum_name> implements org__omg__CORBA__portable__IDLEntity { // one pair for each label in the enum const mapping = array ( "<label>"=><value>, ... "<label>"=><value>); // one static declaration for each label in the enum static public $<label> = null; private $value; static public function initialize() { foreach (<enum_name>::mapping as $name=>$value) { eval("<enum_name>::\$$name = new <enum_name>(\$value);"); } } private function __construct($value) { $this->value = $value; } // get the enum value public function value() { return $this->value; } // get enum with specified value static public function from_int($value) {...} static public function readResolve() {...} } <enum_name>::initialize(); The org__omg__CORBA__* stuff is needed because namespaces are now R.I.P. and my first implementation was done with namespaces (god damn! I had to write all the specification again!). In fact, the "static public $<label> = null;" should be "const public $<label> = new Car(<value>);" but PHP5 doesn't support constant objects, so I need a mapping array and I have to initialize the static attributes at "<enum_name>::initialize();". :-( This implementation is not safe because the static objects can be modified (They should be constants or read-only). The class should be final since it must not be extended by children, assuring that its behaviour would not be modified. This is necessary since this class is in fact a list of predefined constants (in the IDL agreement) and if it gets modified at runtime this could lead to undesired results. Cristiano Duarte. "Alan Knowles" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > As far as I could see you only have final for methods, and not attributes. > > http://ny1.php.net/talks/show.php/php5intro/19 > > Regards > Alan > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php