Re: parent_ctor()

From: Date: Tue, 18 Jul 2000 15:49:58 +0000
Subject: Re: parent_ctor()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-24964@lists.php.net to get a copy of this message
Stanislav Malyshev wrote: > 1. Rename constructors to $SOME_DEDICATED_NAME > - Need: don't see any; Feasibility: can be done; Backward compatible: no 1. Fix spurious inheritance problem Need: yes, to protect classware users from strange errors a. rename constructors to $SOME_DEDICATED_NAME advantage: keep inheritance rules simple (1 rule) disadvantage: breaks compat b. add third rule to PHP ctor naming: inherited methods cannot become ctors (no promotion rule) advantage: keeps compat. disadvantage: 3 rules for ctor behaviour, general design ugliness. There may be addititional monsters lurking with the "fix". > 2. Remove runtime-addable properties > - Need: don't really see; Feasibility: can be done; Backward compatible: no 2. Make runtime-addable parameters removeable, make this default Need: yes, to protect classware from strange errors advantage: users of (foreign or own) classes will get clear feedback when they are using these classes in an unclean way. disadvantage: breaks compat at first, but will force people to clean up their code. Impact can be softened by providing an ini switch to turn this feature off. > 3. Remove methodless objects > - Need: not any; Feasibility: cannot really be done without > removing PHP functions; Backward compatible: no 3. Make classes and types equal. "object" is not a type, "Session", "stdClass" or "IMAPMail" are. advantage: cleaner interface to classes makes language easier to learn, poseAs can be implemented (delegates, anyone?) via settype(), other indirect implications disadvantage: major change in object system, will need much additional thought. > 4. Add keyword referring to parent > - Done. advantage: class notation is now normalized, parent class name is named only in one place. Useful mainly with classware and XMLNS-like namespace management, when a parent class is being renamed on import. disadvantage: none. > 5. Private variables/method > Need: don't see real need; Feasibility: can be done; Backward > compatible: yes, if private access doesn't break execution, no otherwise. 5. Private variables and methods defined semantics: type2: accessing private slots will issue a warning, but not halt execution. Warning is supressible (@ prefix, warning level bit). advantages: classware providers can determine which parts of the interface are public, and which are not. classware users can rely on the definition of the interface of an imported class ("Classware contract" between classware providers and users). Violations of that contract can be marked (@ prefix). disadvantages: none. > 6. Serialzie references > - Need: claims to be useful; Feasibility: really not easy; Backward > compatible: yes 6. serialize references needed to make references first class data types in the language and to make data structured portable from page to page (or to ship them across applications). advantages: constructor applications (cf. Nextstep Interface Builder) can build preinitialized data structures, user applications can simply import these data structures. Much easier than code generation. Many interesting RPC applications become possible. Generally useful for sessions (currently, references will be destroyed by sessions). disadvantages: hard to do because of the strange way PHP handles references. 7. XMLNS type namespace management useful mostly when we have classware to prevent name clashes. Classes of the same name from different providers can be renamed on import to resolve naming conflicts, the specifics of that mechanism need discussion. advantage: clean namespace management and no clashes between classware providers. No central naming registry (cf. Java and java class names) needed, as potential conflicts are resolved by the classware user. disadvantages: strange concept, but not unheard of (see XMLNS). 8. Class serialization Serializing a class makes it necessary to serialize the methods of a class, that is, to save the compiled bytecode of the class. Will make it possible to selectively generate componentware by simply calling serialize() on the class. advantages: No more stdClass objects when importing objects of an unknown class. Very elegant solution to handling bytecode. disadvantages: Hard to do. How do we handle other code objects (functions we can do, but global code does not lend itself well to this paradigm). General overview: All this deals with the idea of classware, reuseable software components and how to better integrate them into the PHP language. This assumes that Zend compiler and source code protection will arrive anytime soon. Their arrival will fundamentally change the way the PHP community operates, as the free sharing of source as it is currently the custom will probably chease for the higher end of the PHP software market. This is because with the arrival of these products such source will now become a marketable product. This was impossible while source was always available. Kristian -- Kristian Köhntopp, NetUSE AG Siemenswall, D-24107 Kiel Tel: +49 431 386 436 00, Fax: +49 431 386 435 99 Using PHP3? See our web development library at http://phplib.netuse.de/

« previous php.dev (#24964) next »