Understanding regexes (Was: Re: DMD 0.147 release)

Georg Wrede georg.wrede at nospam.org
Tue Feb 21 06:38:52 PST 2006


Walter Bright wrote:
> "Georg Wrede" <georg.wrede at nospam.org> wrote in message 
> news:43F658D2.2000608 at nospam.org...
> 
>> Walter Bright wrote:
>> 
>>> "Wang Zhen" <nehzgnaw at gmail.com> wrote in message 
>>> news:dt49iv$2hm5$1 at digitaldaemon.com...
>>> 
>>> 
>>>> Although syntactically correct, MatchExpression in 
>>>> StaticIfCondition or StaticAssert do not compile. For example:
>>>> 
>>>> void main(){static if(!("" ~~ "")){}static assert("" ~~ "");}
>>>> 
>>>> Is this intended or an unimplemented feature?
>>> 
>>> The problem is that getting it to work requires the compiler
>>> itself to understand regular expressions. Currently, it does not.
>>> 
>> 
>> Intriguing. I'd sure love to hear more about this.
> 
> 
> If the compiler is to constant fold regular expressions, then it
> needs to build in to the compiler exactly what would happen if the
> regex code was evaluated at runtime.

Yes. IMHO in essence, the binary machine code, which the runtime also 
would build. What I have a hard time seeing is, how this differs from 
building a normal function at compile time?

And eventually storing both in the executable image.

(I'd give you more intelligent questions, but I'm too baffled.)



More information about the Digitalmars-d-announce mailing list