On Tue, Feb 17, 2009 at 3:16 PM, BCS <a...@pathlink.com> wrote: > > could this be transitioned to CTFE? you could even have a debug mode that > delays till runtime > > RegEx mather = new CTFERegEx!("some regex"); > > > class CTFERegEx(char[] regex) : RegEx > { > debug(NoCTFE) static char[] done; > else static const char[] done = CTFECompile(regex); > > public this() > { > debug(NoCTFE) if(done == null) done = CTFECompile(regex); > > base(done) > } > }
For what it's worth the Tango regexes actually have a method to output a D function that will implement the regex after it's compiled. So you _could_ precompile the regex into D code and use that. But seriously, man - if something takes 60 seconds to complete at _runtime_, making it CTFE would simply make your computer explode.