On 30/10/14 07:19, Will Fitch wrote: > The magic method is more of a PHP approach while an interface would be more > appropriate. That said, this RFC is a true representation of a hash vs > something like spl_object_hash. That’s what causes user confusion. > spl_object_hash would’ve been better served as a name like spl_object_id or > spl_object_hash_id. Something that indicates uniqueness regardless of the > values of a particular object.
The bit of the jigsaw I'm still missing here is just what the object of the exercise is? In the good old days one would have created an array of 'boxes' and we could put anything in the boxes. The key would be something suitable to describe the box, and the box could contain a 'sub-array' of material, or a handle to content. My real life situation today is that the key is always a simple 64bit number and I need a means of making that work transparently between 32bit installations and 64bit ones. No need for 'magic methods' or any processing of the content of the object being handled. Since in many cases the object IS just a record from the database, in some circumstances there is little point even creating an object, one just passes by reference the 'sub-array' values to a static set of code and that spews out a set of html for the output. And on a persistent connection all that can be held in memory. Since the id is always unique one can check if the content has already been loaded simply by looking for the id in the base array. The core design of the system solves many problems that can arise. If one has a new version of an object one either creates a new bucket ( this is what the underlying database will do anyway ) or if history is not important simply apply the data direct. It depends on how one needs to go back through the data if you create a new id, although if one is recording for example addresses, then each old record needs to maintain it's own data. If one is simply reading raw data from an unmanaged source, then some means of identifying the data is important, and producing a 'hash' of the material is a valid approach to checking if a previous copy of the same data has been processed. But even here there is no 'magic' way of handling the data, it needs a certain amount of existing knowledge to identify items in the data that can be matched. SO an 'interface' that allows the creating of a suitable ID is what we are talking about? And one that provides a link to the underlying content what ever it is? So arrays do exactly what they are good at and allow a bucket of content to be managed as required? Trying to use the 'object' as a key is just wrong how ever one looks at it? -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php