I have an almost working implementation but that does not work. That's because SplPriorityQueue does not guarantee the order in which elements are inserted for the same priority. In the current implementation, we implicitly rely on the fact that the latest registered listener is the last listener in the array (for the same priority of course).

For instance, if you run the following:

$q = new \SplPriorityQueue();
$q->insert('a', 1);
$q->insert('b', 1);
$q->insert('c', 1);
$q->insert('d', 1);
$q->insert('e', 1);
$q->insert('f', 1);

Here is the order in which you get them from the iterator:

a
f
e
d
c
b

Fabien

--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.org | fabien.potencier.org
Tél: +33 1 40 99 80 80

On 11/15/10 9:40 PM, Jeremy Mikola wrote:
Ah, I didn't realize SplPriorityQueue made non-prioritized removal
impossible (just checked the docs on its interface).  I agree with Pablo
that the benefits of using it outweigh this edge case, though.  +1

On Mon, Nov 15, 2010 at 2:56 PM, Fabien Potencier
<[email protected]
<mailto:[email protected]>> wrote:

        Was the single-listener mode for disconnect() a candidate for
        removal?
        I'm not sure why it was brought up in the OP (I will say I like
        the idea
        of using SplPriorityQueue, though).


    Yes, the single-listener mode for disconnect() is something I want
    to remove since the symfony 1.X days. And implementing
    SplPriorityQueue is just one more argument for removing this support.

    So, does everyone agree that we can remove this and merge the
    SplPriorityQueue implementation?

    Fabien




--
jeremy mikola

--
If you want to report a vulnerability issue on symfony, please send it
to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to