On Oct 22, 2007, at 12:57 PM, Vincent Bray wrote:
On 22/10/2007, Jim Jagielski <[EMAIL PROTECTED]> wrote:
Say you are looking for 'foo' and have a bucket that
contains 'jimfoojag'. The fast way to handle this would
be to split off 3 buckets from this, one containing
'jim', the other containing 'jag' and the middle one that
contains the substitute for 'foo' (say it's 'bar'). The rub
is that the pattern matching looks at buckets only, so you
wouldn't see a full bucket that contains 'jimbarjag' and
so if you had a search for 'mbarj', it would be missed using
the "fast way". In the slow way (flattening), instead
of creating the 3 buckets, you go ahead and smash them all
together resulting in the single bucket that now contains
'jimbarjag'. Now the search for 'mbarj' would succeed.
That's much clearer now, thanks. I've committed my first shot, so
please give it a critical eye. Is there a need to add further
explaination of 'f' here? Also, surely there's a less contrived
example than s/foo/bar/..
I guess the big issue is that if one expects to
substitute previously substituted items, then one
should use flatten, but it results in much slower behavior.
If the substitutions are self-contained, and can't
"overlap" each other, then the default is fine and fast.
So:
s/foo/bur/
s/burp/belch/
and you want 'I fooped' to be changed
to 'I burped' -> 'I belched' then you need
flatten.