earthquake changes of std.regexp to come

bearophile bearophileHUGS at lycos.com
Tue Feb 17 10:50:05 PST 2009


Don't be too much hard with the good Walter, please :-) One good thing in his designs (in D1) is that they are often simple to use: they give you back much more than you give them. D2 seems to ask much more from the programmer.

I agree that the API of regexes in Phobos is not much good, but I think designing a good API for it is quite hard.


> I just wanted to ask whether y'all could stomach yet 
> another rewritten API or you'd rather use std.regexp as it is for the 
> time being.

I have no problems in accepting changes here too. D2 is already essentially another language compared to D1.

Regarding regexes of D1 Phobos, it has problems bigger than just the API, in the past I have found some common cases where it is O(n^2) or more.

You can see a case of such behaviours here (look at my comments that show what parts are slow, I have also commented out versions that more logical but much slower):
http://shootout.alioth.debian.org/debian/benchmark.php?test=regexdna&lang=gdc&id=4

If you want to test that code you can generate test data with this other code:
http://shootout.alioth.debian.org/debian/benchmark.php?test=fasta&lang=dlang&id=1

Bye,
bearophile



More information about the Digitalmars-d mailing list