Would there be interest in a SERIOUS compile-time regex parser?

Sean Kelly sean at f4.ca
Tue Oct 17 13:13:10 PDT 2006


Don Clugston wrote:
> 
> Imagine if there were some way to create an alias
> makeProgram(char [] pattern, int otherparameters)
> 
> which became
> makeProgramAtCompileTime!(pattern)(otherparameters);
> if pattern were a compile time literal,
> but became
> makeProgramAtRunTime(pattern, otherparameters);
> if pattern were a variable.
> 
> Then the user wouldn't even need to know that they were using templates.

I've always thought that meta-heavy libraries like Blitz++ were a noble 
attempt at something the language didn't really support, but the ability 
to mix compile and runtime code using the same call syntax would 
completely change things.

> One possible syntax would be something like:
> 
> real sqrt(template real x)
> {
>   static if (is(x: const)) return sqrt_compiletime!(x);
>   else return sqrt_runtime(x);
> }

This is pretty clear and straightforward.  Something along these lines 
would be a killer feature for 2.0.


Sean



More information about the Digitalmars-d mailing list