On Nov 12, 7:31 pm, Raul Parolari <raulparol... / gmail.com> wrote:
>
> But the point that JGII is making about 're' is not that he prefers
> Regexp literals vs variables! it is that if the regexp variable
> contained an anchor like \A it does not make a lot of sense to call
> gsub... because it would at most match once!
>
> So while we may not know the exact content of the regexp (eg, it is
> provided by another component, etc), it makes sense to think that at
> least we know it is suited to a global replace (if not, what exactly are
> we doing? the whole thing loses any sense).

Of course I understand JGII's point, but he does not understand mine.
The regexp gsub example is totally irrelevant in its particularity ---
the whole point was the use of Object#as with a block which *cannot*
be replaced with a standard method.  It could be any block at all ---
it doesn't matter what it is.

Instead of trying to understand the overall aim, which was the use of
Object#as, JGII decided to be pedantic about the contents of the
block.  Well, two can play the pedantry game.  He wanted to replace
the block with concat(), which is simply incorrect.  But, again,
nonetheless irrelevant.

Due to the distracting cruft in this thread, I'll start another one.