in reply to RFC and debugging tips
In truth, I like using logical operators for this sort of thing, and personally find them very readable. Benefit of a C background.
The thing that bothers me with reading your code is your API. It is emergent from the logic and not very intuitive. You are implementing a class with a single closure which takes zero or more arguments.
Note that each instance of a uFIFO carries an interpreter around with it.
How about an implementation as a module? Make Uniqueue.pm define a data class with a constructor, a $fifo->enqueue( @foo ) acting like push, and a $fifo->next() which acts like either shift or a nondestructive iterator, depending on what behavior you want. Other methods like 'all' or 'reset' then can be defined as methods also.
I've coded a Uniqueue.pm in terms of shift. If there's interest, I'll send it to the catacombs.
After Compline,
Zaxo
|
---|