On Sun, Nov 14, 2004 at 07:18:53PM -0800, Yitzchak Scott-Thoennes wrote:
> On Sat, Nov 13, 2004 at 12:01:50AM +0000, Dave Mitchell wrote:
> > Note that interpolated strings already work badly with re evals:
> >
> > $foo =~ "abc(?{$x++})def"
>
> WFM:
> $ perl -we'"abcdef" =~ "abc(?{\$x++})def"; print $x'
> 1
I was trying to point out that in qq-ish strings, (as apposed to qr-ish
strings), (?{..}) isn't escaped by default, so I think it's reasonably
unlikely that anyone would have not used used //, ie they are more likely
to have written /abc(?{$x++})def/ rather than "abc(?{\$x++})def". The same
logic doesn't apply to q-ish strings of course.
> > So, should I break the behaviour of (?{}) in single-quoted strings,
> > or is there another way?
>
> I'd say go ahead and break it.
I'm currently tempted to keep the old behaviour - ie for a single constant
string that isn't a pattern, compile it at compile time, with the
re_eval code being compiled in separate eval CV(s) like present. It means
that the code won't be compiled into the parent CV like most stuff will
be after my patch, so it will still be buggy closure-wise, but it's
proably better than nothing.
--
In the 70's we wore flares because we didn't know any better.
What possible excuse does the current generation have?