Hello Robert, Tuesday, October 19, 2004, 4:32:58 AM, you wrote:
> On Mon, 2004-10-18 at 22:09, Robert Silva wrote: >> Based on the issues you listed, how about: >> >> function Method((MyClass) $obj); >> function Method([MyClass] $obj); >> >> Surrounding the class type in () or [] thereby marking it as optional. >> Much like you would do when commenting a function to take an optional >> parameter. > I like this idea and just for the sake of consideration and to elaborate > on it: > function Method( [MyClass,YourClass,null,bool] $obj ); > which would allow all of the above types as values for $obj. Which would > allow a great deal of flexibility while retaining a good deal of > readability. While [] is a nice idea for the remaining problem allowing multiple types is a very bad idea. Instead you should use Interfaces and finally learn that neither will we allow basetypes as typehints nor is null a type. Which brings me back to my opinion that you should fix your code and find a way to live with typehints as they are. Their usage means you can rely on the fact that a certain class type or interface is present. That means i could agree to have a way to mark typehinted values as optional but i won't live with allowing to pass null values. Though i guess that the majority is not the complaining few here but the ones being happy with typehints as they are. The argument of null references doesn't count here because c++, java and php do work very differently and due to it's nature php does not need null references and to be honest we cannot and will not support that. regards marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php