earthquake changes of std.regexp to come

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Feb 17 12:26:33 PST 2009


On Tue, Feb 17, 2009 at 3:16 PM, BCS <ao at 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.



More information about the Digitalmars-d mailing list