On Thu Jun 17 19:07:29 2010, user42@zip.com.au wrote:
Show quoted text> I noticed the current code is "sometimes recursive" :-)
>
> use List::Uniq 'uniq';
> print uniq('foo',[['bar'],['quux']]);
>
> => fooARRAY(0x9572818)quux
>
> but could tell if that was meant to be supported or not :).
>
> > I'm also concerned that adding the recursion will break existing
code,
Show quoted text> > even though I can't imagine a use case in which you want to uniq
> > something containing the stringified representations of listrefs.
>
> If uniqueness is by stringizing then it doesn't make much sense to
have
Show quoted text> arrayrefs. And if flattening is done at the toplevel now then you'd
be
Show quoted text> inclined to do it recursively on the same basis.
>
> The only thing against flattening might be objects with overloaded
> stringizing which could be uniqued without wanting to recurse into
them.
Show quoted text> But could have a non-flattening version or option later if anyone
wanted
Show quoted text> that.
The original design was to flatten to one level, but obviously that
broke on empty array refs. In re-familiarizing myself with the code, I
couldn't see any reason why the flattening shouldn't be recursive.
I've now made the new recursive flattening the default, with the ability
to turn it off using the options hash.
0.20 is now on its way to CPAN via PAUSE.