| CPAN Ratings Data-Stack reviews | |
| Home | Search | About | Bitcard Account | Login |
RSS | Module Info | Add a review of Data-Stack
@Ron Savage
You should read the source code more carefully, it does exactly what is expected from a stack (LIFO) implementation. Internally it's using unshift to to push and shift to pop the stack which might seem counter intuitive depending whether or not you consider index 0 the top or bottom, but regardless that is an internal matter and doesn't deserve your warning and harsh criticism.
--
chansen
Christian Hansen - 2011-06-14T06:04:08
It looks like a joke module to me. Everything here is already provided by Perl arrays. I imagine the author knows that? Surely nobody actually uses this.
Ben Bullock - 2011-06-11T22:42:33
To Christian:
I can only draw your attention to
<a href="en.wikipedia.org/wiki/Principle_of_le... Principle of Least Surprise</a>
It's a good guideline on how to avoid bad interface or implementation design.
To Ben:
No, I don't think it's a joke module. You might be thinking of a stack simply using my(@stack), etc.
However, when the stack (arrayref) is an attribute of an object of a class, it becomes a bit painful to be always doing:
my(@stack) = @{$self -> stack};
push @stack, $new_data;
$self -> stack([@stack]);
Vastly better is $self -> stack -> push($new_data).
So, having a rational module, like Queue::Base, to manage something like this, makes sense. Or at least, it ought to make sense.
Ron Savage - 2011-06-11T16:09:29
|
Perl.org sites
: bugs
| dev
| history
| jobs
| learn
| lists
| use
Site Information and Contacts |
|