Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-25 Thread Etienne Kneuss
Hello, On Sun, Jan 25, 2009 at 4:24 PM, Lukas Kahwe Smith wrote: > > On 24.01.2009, at 19:19, Guilherme Blanco wrote: > >> 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

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-25 Thread Lukas Kahwe Smith
On 24.01.2009, at 19:19, Guilherme Blanco wrote: 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! =

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-24 Thread Guilherme Blanco
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_DE

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-24 Thread Oskar Eisemuth
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 stil

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-24 Thread Guilherme Blanco
Oskar, 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. Also, your code may still be possible to use SplObjectStorage. Etienne did a lo

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-23 Thread Oskar Eisemuth
Hello My usage for spl_object_id wouldn't be solved with SplObjectStorage, here is my current event handler (it uses spl_object_hash) I still have the plan to replace it with something better but it simply works, currently it's not possible to "free" an object. EVENT::register accepts a static c

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-22 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 2:38 PM, Etienne Kneuss wrote: > Hello, > > On Tue, Jan 20, 2009 at 2:23 PM, Guilherme Blanco > wrote: >> Etienne, >> >> We all already considered to not implement spl_object_id as long as >> spl_object_hash is optimized. > > Ok then, I'll provide a patch to improv

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 2:23 PM, Guilherme Blanco wrote: > Etienne, > > We all already considered to not implement spl_object_id as long as > spl_object_hash is optimized. Ok then, I'll provide a patch to improve spl_object_hash's performance, which will also change it's output. Documenta

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Guilherme Blanco
Etienne, We all already considered to not implement spl_object_id as long as spl_object_hash is optimized. Regards, On Tue, Jan 20, 2009 at 11:20 AM, Etienne Kneuss wrote: > Hello, > > On Tue, Jan 20, 2009 at 1:41 PM, Hannes Magnusson > wrote: >> On Tue, Jan 20, 2009 at 13:26, Etienne Kneuss

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 1:45 PM, Guilherme Blanco wrote: > Hi, > > It seems SplObjectStorage will solve my issue. > We already spoke on pvt about how to handle things correctly too. > > Although this solve my issue, the point that Stan highlighted is > valid. You may not find a good place

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 1:41 PM, Hannes Magnusson wrote: > On Tue, Jan 20, 2009 at 13:26, Etienne Kneuss wrote: >> >> Could you please provide an example, with code, in which this function >> would be necessary ? (i.e. where you can't use SplObjeccctStorage) > > Why? > > As far as i under

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Guilherme Blanco
Hi, It seems SplObjectStorage will solve my issue. We already spoke on pvt about how to handle things correctly too. Although this solve my issue, the point that Stan highlighted is valid. You may not find a good place where to use it, but spl_object_hash is there and it has drawbacks. Just namin

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Hannes Magnusson
On Tue, Jan 20, 2009 at 13:26, Etienne Kneuss wrote: > > Could you please provide an example, with code, in which this function > would be necessary ? (i.e. where you can't use SplObjeccctStorage) Why? As far as i understand, the issue is that spl_object_hash() is slow and people want a faster a

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 11:47 AM, Stan Vassilev | FM wrote: > > Hi, > > I had a talk with Marcus, and he has agreed on this proposed solution: > > 1) SPL generates a pseudo-random session id/mask (for the current request, > do not confuse with $_SESSION), which consists of 32 random > byte

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Stan Vassilev | FM
Hi, I had a talk with Marcus, and he has agreed on this proposed solution: 1) SPL generates a pseudo-random session id/mask (for the current request, do not confuse with $_SESSION), which consists of 32 random bytes/characters. 2) The object is and the handler pointer are used to create a uni

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, We already had that discussion in private, but here is a on-list summary: On Mon, Jan 19, 2009 at 5:39 PM, Guilherme Blanco wrote: > Ok, > > We'll use this method inside Doctrine ORM version 2.0, scheduled to be > released on September 1st, 2009. > > One main location where we are already

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-19 Thread Guilherme Blanco
Ok, We'll use this method inside Doctrine ORM version 2.0, scheduled to be released on September 1st, 2009. One main location where we are already using it is during Hydration process. The process of grab a DB tuple and convert it into an Object graph. Here is the usage. Each Object of the graph

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Marcus Boerger
Hello Etienne, Wednesday, December 17, 2008, 7:59:01 PM, you wrote: > Hello, > On Wed, Dec 17, 2008 at 7:29 PM, Lars Strojny wrote: >> Hi Guilherme, >> >> thanks for moving the discussion to the list. >> >> Am Mittwoch, den 17.12.2008, 15:31 -0200 schrieb Guilherme Blanco: >> [...] >>> It seems

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Lars Strojny
Hi Andi, Am Mittwoch, den 17.12.2008, 10:33 -0800 schrieb Andi Gutmans: > Shouldn't you be using RETURN_STRINGL with length and dup=0? Yes, the more recent implementation does exactly that :) cu, Lars signature.asc Description: Dies ist ein digital signierter Nachrichtenteil

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Etienne Kneuss
Hello, On Wed, Dec 17, 2008 at 7:29 PM, Lars Strojny wrote: > Hi Guilherme, > > thanks for moving the discussion to the list. > > Am Mittwoch, den 17.12.2008, 15:31 -0200 schrieb Guilherme Blanco: > [...] >> It seems that Marcus controls the commit access to SPL. So I'm turning >> the conversatio

RE: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Andi Gutmans
Shouldn't you be using RETURN_STRINGL with length and dup=0? Andi > -Original Message- > From: Guilherme Blanco [mailto:guilhermebla...@gmail.com] > Sent: Wednesday, December 17, 2008 9:31 AM > To: internals Mailing List > Subject: [PHP-DEV] New function proposal: s

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Lars Strojny
Hi Guilherme, thanks for moving the discussion to the list. Am Mittwoch, den 17.12.2008, 15:31 -0200 schrieb Guilherme Blanco: [...] > It seems that Marcus controls the commit access to SPL. So I'm turning > the conversation async, since I cannot find him online at IRC. > So, can anyone review th

[PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Guilherme Blanco
Hi, I spoke with some devs yesterday about spl_object_hash performance and alternatives to solve it. Seems that md5 applied inside it is the responsable for that. After some tips from Lars, we came with a patch (at the bottom of this email). The new proposed function is already being used in Doct