I see a problem with this. Scalars are automatically casted by PHP based on a set of rules. In case of a scalar type hint, would jo issue an error, or make the automatic type cast? both approaches have there advantages, but the automatic cast, would go better with the actual features of the language, but in this case, object could also cast an array to stdClass, and i am not sure that's how you imagined it. Besides this i am not against it along as it doens't create implementaion nor performance problems, and this problem is solved. 2009/1/18 Nathan Rixham <nrixham@xxxxxxxxx> > Hi All, > > preface: Having discussed at great length previously and probably > completely misnaming and thus misleading the conversation here goes again. > > question: Would anybody else like to see, or feel the need for, *optional* > type hinting of variables and class properties in PHP? > > examples (all optional, and syntax may differ): > > class Example { > private TypeHint $var; > } > > Example $var = new Example(); > > in addition the ability to type hint primatives/scalars/[type object] in > the existing implementation: > > function(bool $flag) { > } > > function(object $flag) { > } > > > > This would all be under the assumption and proviso that an implementation > would not break bc, have any markable perfomance hit, or in any other way > effect existing applications or new applications that did not use the > functionality (in the same way the existing type hinting implementation > doesn't) > > Any +1's? > > Regards. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Torok, Alpar Istvan