earthquake changes of std.regexp to come

BCS ao at pathlink.com
Tue Feb 17 13:01:19 PST 2009


Reply to Jarrett,

> 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.
> 

For any kind of debug, yeah, that's a problem. OTOH for release, as long 
as it /does/ compile, who cares? How many real release builds does anyone 
do a week?





More information about the Digitalmars-d mailing list