On Wed, 3 Mar 2004, Andrew Pimlott wrote: > As an immediate reaction from someone who hasn't used any of the > Set/Span modules, I don't like that last part. One, it's too easy for > someone who only skims the documentation to miss it, and end up with a > very subtle bug. Two, lots of functions return undef, so people are > going to end up with ugly code like > > $set->iterate( sub { myfunc($_); 1 } ); > > just to avoid the effect. I think if you want to be able to modify the > set, you should provide different methods for that. ->map and ->grep > come to mind.
I agree, this is an awkward API and it's highly prone to weird bugs, since so many things can return undef. I kind of like the idea of calling this method map myself, since what it would do is so similar to the Perl built-in. > I notice that this method with the same undef semantics already exists > in Set, however it is marked experimental, so perhaps it can still > change. It probably should. This is just going to bite way too many people. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/