[dev] prefix display

Anil Madhavapeddy anil@recoil.org
Mon, 13 Nov 2000 22:29:25 -0000


Chuck Hagenbuch wrote:
> 
> Hmm. I think it's a strength to handle multiple folders; it also 
> keeps things encapsulated in IMP_folder:: as much as possible, 
> which IMHO is a _very_ good thing (TM).
> 

Well, it does complicate the return value a lot though; if you
have to return an array of objects instead of a single one,
the code would not look as nice.

e.g. to use it if it only accepted one object:

foreach ($folder_list as $folder) {
   $ret = IMP_folder::delete($folder, ...);
   <process ret object>
}

or if it accepts an array and returns an array of
PEAR::Error objects (or whatever):

$ret_list = IMP_folder::delete($folder_list, ...);
foreach ($ret_list as $ret) {
   <process ret object>
}

I prefer the former; you are processing the return immediately
after the call, and not getting a bunch of them back (suppose
one folder deletion fails; you might want to halt immediately
instead of trying the other ones)

--                      
 Anil Madhavapeddy / "I told you not to flush that!" 
 anil@recoil.org   /    Stern Lecture Plumbing