[cmake-developers] slow regex implementation in RegularExpression

Brad King brad.king at kitware.com
Wed Nov 23 12:18:48 EST 2011


On 11/23/2011 12:06 PM, Bill Hoffman wrote:
> On 11/23/2011 11:43 AM, James Bigler wrote:
>> Why can't this be solved with a policy?  One problem of using an
>> explicit TRE command is that if you want to write code that *could* be
>> used in an older version of CMake you won't be able to use it.
>>
> It could be, but that will not come without pain.  I can see a future 
> were this policy kept off in many projects.

We can wrap both the TRE and KWSys regex implementations in a
"cmRegularExpression" that provides the same interface for both.
Then we can implement the policy at that level.  If the policy is
set to OLD, use the KWSys implementation.  If the policy is set
to NEW, use the TRE implementation.  If the policy is not set, then
do *both* implementations and compare the results of matching.  If
they are different warn about the policy not being set and favor
the KWSys result for compatibility.

> I don't think we even know what all the differences are at this point...

The above approach would reveal differences without breaking projects.
Alex C. should produce some unit tests for the existing behavior
which we should have had all along.  Even though we probably cannot
think of everything every project is doing at least we will know up
front if something major is different.

Policies are meant for use when the new behavior is clearly better
than the old behavior in every way and should have been the way it
was always done had it been available from the beginning.  This is
such a case.  We are not switching between two desirable behaviors.
The only argument in favor of the old behavior is that is how it
works now.

-Brad



More information about the cmake-developers mailing list