On Sun, 2006-06-04 at 20:49, Gwynne wrote: > On Jun 4, 2006, at 8:33 PM, Michael Gall wrote: > >> For example, for an eBay Item object, my __toString() returns the > >> Title, but that's not unique, so my __toHash() returns the numeric > >> ID, > >> which is. > > While I wouldn't be surprised if you completely ignore my opinion, > > however I > > think the __toHash implementation should happen in an interface, > > rather than > > happening automagically. That will make it just a little bit more > > predicatable. > > +1 on that from me. There is definitely a use for a __toHash() magic > function WITHOUT it being automagical. An automagical one would > probably lead to a lot of confusion and odd behaviors. Let people use > the feature if they need it and ignore it otherwise.
But enforcing it's use via an interface means class users that don't want to use interfaces now need to use interfaces. Also the other magical functions aren't linked to interfaces, why change tradition? Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php