Re: LIFO package?

From: Date: Tue, 23 Mar 2004 15:05:49 +0000
Subject: Re: LIFO package?
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-26679@lists.php.net to get a copy of this message
Tobias Schlitt wrote:
<quote who="Philippe Jausions (11abacus.com)">
Isn't that just a wrapper around "array_*" methods? Like array_push(), array_pop(), count(),...
     
Yes, basically. It allows to stack things from anywhere since I'm using a static class method. This enables me to have several classes working on the same stack without having to create an object, global variable... The stack is also multipurpose, because the FIFO class manages several stacks in parallel.
Hi! In generally that sounds not bad to me. But a package containing 1 single class implementing a simple stack is not the way to go in PEAR, IMHO. I would preffer to have package containing more of this "standard", "advanced" datatypes realized in PHP e.g. queue, lists, linked lists, and so on. Toby Hi,
Wouldn't an "advanced" package be better served by DOM? My package is basically an "abacus" structure, that is multiple parallel stacks of beads (or elements), where an element could be anything. I needed something very fast and not bloated. As far as what to include in PEAR, I'm not sure that only "advanced" packages should be considered, if something is used often enough, but simple and limited in scope, why not make it a package for everybody to re-use? If advanced datatypes can be added without impeding with performance or ease of use, that would be great... For now, my little, FIFO class is quite enough. Example: <?php require_once('LIFO.php'); function a($property) { LIFO::push($property, rand()); } function b($property) { echo $property . ': ' . LIFO::pop($property) . "\r\n"; } $functions = array('a', 'b'); $properties = array('left', 'top', 'right', 'bottom'); for ($i = 0; $i < 100; $i++) { $function = $functions[array_rand($functions)]; $property = $properties[array_rand($properties)]; $function($property); } ?>

« previous php.pear.dev (#26679) next »