Instead of building two implementation (Stack and Queue), maybe it is better to do one implementation, a ordered set.
The advantages are:
We want a set (No duplicated handlers, post/pre-emits).
We want iteration to occur on order of insertion (usually sets does not provide this, but we can).
We want to insert only in the begining or the end (stack or queue behaviour).
We want to remove some element from any position of the set, but remain with the older order...on a efficient way (this can be achieved with a implementation based on the List example of the PIL book, but some modification to our aplication).
With a Set behaviour the Signal does not to care if there is already a handler or emit function registered, the Set simply discards an element if you try to insert it again, all this done with O(1), using the idea given on the list of two tables (table[pos] = value, table[value] = pos).
It would be a mix of List implementation from PIL book with the idea given on the list with changes to be better suited to our application.
adding OrderedSet interface -closed by a24265aa20544e86b5303dd494bd2dc5d278f46e -closed by a24265aa20544e86b5303dd494bd2dc5d278f46e -closed by a24265aa20544e86b5303dd494bd2dc5d278f46e
Instead of building two implementation (Stack and Queue), maybe it is better to do one implementation, a ordered set.
The advantages are:
With a Set behaviour the Signal does not to care if there is already a handler or emit function registered, the Set simply discards an element if you try to insert it again, all this done with O(1), using the idea given on the list of two tables (table[pos] = value, table[value] = pos).
It would be a mix of List implementation from PIL book with the idea given on the list with changes to be better suited to our application.