Front page | perl.perl5.porters |
Postings from January 2012
Re: whither study()?
From: Chas. Owens
January 31, 2012 05:43
Re: whither study()?
Message ID: CAH2YjjHLcJxW=SdueYNzYcJTXFJFJT3j3Nk3yPE_+dS7rzFYhw@mail.gmail.com
On Mon, Jan 30, 2012 at 18:19, Ricardo Signes <firstname.lastname@example.org> wrote:
> * demerphq <email@example.com> [2012-01-29T04:41:33]
>> Is it really in Perls interest that I, or anyone else with the chops,
>> even looks at fixing the bugs related to it? Can we just no-op and
>> deprecate it?
> A few years ago, I casually proposed deprecating it. This was on IRC or at a
> conference or something. A few people objected that it was actually useful, at
> least sometimes, so I know it's being used.
> Is it being used to any effect, in most cases? Is it introducing problems?
> Are the breakages that it introduces the only thing keeping code working, now?
> Hoo boy!
> If it really is as broken as you say -- and I have no reason (or desire!) to
> doubt you -- then it does seem worth doing something about.
> Do we really want to deprecate it? Some day, maybe we will want to add this
> feature back, and someone will have the energy to write a useful implementation
> and test suite. Unlike many features, where there's some design gain to be
> made by ditching it, study isn't a wart. It's just a once implemented and now
> pretty busted thing that might be useful again someday.
> The promise of study is that everything will work the same, with some shift in
> where cost is. What if study became a nop?
> We could issue a "useless use of study" but do we really need a warning? The
> change would be "fixed a bug where study caused regex matches to behave
> incorrectly," and the performance hit would be like any other disabled bad
> optimization. What do we know about how much real effect this would be likely
> to have?
>> Does anybody have any examples where it actually makes a difference?
> I second that question, but I only care if the difference is the kind of thing
> we want to keep around. ;)
It should probably be documented the same way the less pragma is
documented. Something like:
=item study SCALAR
At this time, C<study> does not do anything. It is intended make
regexes faster by
taking extra time to study SCALAR (C<$_> if unspecified); however, no
case has been
found where this studying improves the speed of a regex on the modern
At some future date, C<studay> may again do something, but, for now,
it is a no-op.
The most important skill a programmer can have is the ability to read.