Show quoted text> If there are crashes, there is definitely a bug in perl. I suspect the
> main problem may have to do with concatenation overloading. It has
> bothered me for some time that perl regexp compilation will trigger
> concatenation overloading, which makes little sense to me, as it is
> for *strings*, not regexps, which, as you see, are a completely
> different creature.
>
> I wonder whether disabling string concatenation overloading will fix
> it.
The problem with doing that is that the 'qr' constant overloading is
only passed the compile-time constant parts of a regex. So if you
have:
/abc $var def/
then the overloading is called twice (with 'abc ' and ' def'
respectively). The only way to grab and process the *entire* regex is to
have the first call return an object with concatenation overloading, so
that the eventual run-time concatenation of the contents of $var can be
trapped and produce yet another object, which can trap the second
concatenation to produce a final object...whose stringify or 'qr'
coercion can then finally process the entire regex pattern to produce
the desired effect (in this case, inserting the necessary parsing
machinery).
Without that elaborate work-around, Regexp::Grammars regexes could not
contain any interpolations, which would make them vastly less useful. It
may still come to that, if I can find no other solutions, but it would be a
significant loss of utility, if it does.
Show quoted text> In any case, I think this should really be fixed at perl’s end.
Agreed.
Show quoted text> Please do report a bug, so this can be fixed for 5.20 (or 5.18.1 or
> .2, if the changes are not too sweeping).
I certainly intend to, as soon as I can spare enough time to boil an example
down to less than the 2500 lines of the module itself. ;-)
But, as I'm in final preparation for a five-week round-the-world speaking tour,
"as soon as I can" will probably not be "as soon as I'd prefer".
Damian
Damian