Re: New function proposal: spl_object_id
| From: | Guilherme Blanco | Date: | Sat, 24 Jan 2009 18:19:21 +0000 |
| Subject: | Re: New function proposal: spl_object_id | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42816@lists.php.net to get a copy of this message | ||
Hi Oskar,
Yes, you can use a plain array too.
I was just giving you a normal approach (ArrayAccess inherited class)
because you may want a special behavior under it too.
Forget SplObjectStorage docs.... they're outdated.... read the source! =)
Undoubtely devs will not mark spl_object_hash a E_DEPRECATED... I'll
kill each one if they want to! =P
Cheers,
On Sat, Jan 24, 2009 at 4:05 PM, Oskar Eisemuth <patchnow@gmail.com> wrote:
> Hello Guilherme
>
>> The new implementation of spl_object_hash will solve it, since it's a
>> faster implementation than the old one.
>> Just one hint, you should not try to echo the generated hash, since it
>> may have non-printable chars.
>>
>
> I don't think that will be a problem...
>>
>> Also, your code may still be possible to use SplObjectStorage.
>> Etienne did a lot of research regarding how it could be used, and he
>> showed me that a n-dimensional array is possible too.
>>
>> In your situation, $events should be an ArrayAccess instance, while
>> each $events[$event] should be an SplObjectStorage.
>>
>
> May I ask why your sample uses ArrayAccess instead of a plain array()? And
> ArrayAccess is an Interface, now I am bit puzzled.
>
> SplObjectStorage will only allow objects (Docs?), I register static classes
> as event listener, so something like this won't work:
>
> EVENT::register("myevent", "Autoloader", "onmyevent"); //
> Register
> Autoloader::onmyevent() as event listener.
>
> A reason I wrote SplObjectStorage won't solve my usage of spl_object_hash..
>
> So don't mark spl_object_hash deprecated in 5.4 ;-)
>
> Best regards
> Oskar Eisemuth
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9215-8480
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Paulo - SP/Brazil