On Thursday, April 26, 2012 11:25:24 AM UTC+9,
bill....@gmail.com wrote:
Thanks for the patch. I'm not going to implement it becuase I'm not going to be changing any more in ack 1.x about how filetypes are detected. ack 2.0 will handle this very flexibly.
This patch looks quite plausible as a interim measure to keep ack 1.x fresh ( working for new users & usecases ) while we await ack 2 closure -- if only to avoid reinventing the perl6-caused gap in perl5. It's a great idea and we should give a bit more consideration to a fix like this unless ack2 is truly immanent .
However I would only vote for it if it is truly conservative, changing no behavior when new flag not used. As presented that is not the case, but it's repairable.
The regression danger I note is it steps over m{/.*/env\s} and/or m{/$pathpattern/} before taking the **next** token, instead of looking for any of a list of tokens **anywhere** in the line.
Yes, I considered the old logic broken because it can
introduce false positives and ambiguities. With the
new pattern only one language can match. In 99.9%
of the cases they will be equivalent though.
I'd bet dollars to donuts that if you can find any example
where they differ, then it's an example of a bug in the old
logic that has been fixed :)
I would recode it to build a pattern of the known tokens from the hash indices (once), and look up the match (if any) in the hash, to eliminate the change to behavior on edge cases.
Sure, if we're not even applying bugfixes to 1.x then it
would be easy enough to do this.
--
Alex