Re: Trying to catch up

From: Date: Sun, 15 Oct 2000 15:14:05 +0000
Subject: Re: Trying to catch up
References: 1 2 3 4  Groups: php.pear 
Request: Send a blank email to php-pear+get-379@lists.php.net to get a copy of this message
> > > 3. Is for PEAR also meant to write wrapper classes for all the non-OO > > > PHP functions, > > > like the array functions? I am asking that because since PHP4 there are > > > many new array > > > functions and the naming is not really "one style", some are called > > > array_xxx and others > > > dont have this prefix. > > I think this is a personal preference kind of thing. There's Net/Socket.php to > wrap the socket functions, but this to me is added functionality over the array > functions - it keeps track of the handle for you, persistence, provides methods > like readIPAddress, etc. A straight wrapper over the array functions wouldn't do > anything that you couldn't do by aliasing some php functions. So if aliases are > needed to add consistent names, let's do that instead. but is PEAR not meant to be OO? and wrapping the array stuff in a class does also prevent from name-conflicts. i could imagine that array and string functions sometimes may get the same name like "split" or others a (wrapper)-class for the array stuff just leaves more space for naming, which an alias would not, if you always had to check if that function name already exists and making aliases like "array_xxx" in my eyes is a cramp if we can use classes a class would also make the number of parameters of the array functions less i think of it like that: myArray = new array("a","b"); myArray->sort(); - in PHP now: sort(array name) myArray->shuffle(); - in PHP now: shuffle(array name) myArray->slice(0); - in PHP now: array_slice(array name, int offset, int [length] ); the OO-notation looks nicer to me and gives us better opportunity to extend the array functions Wolfram

« previous php.pear (#379) next »