Regex in ctfe?

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 27 11:05:01 PST 2016


On Wed, Jan 27, 2016 at 06:47:59PM +0000, Pierre Krafft via Digitalmars-d wrote:
> On Tuesday, 26 January 2016 at 12:47:26 UTC, w0rp wrote:
> >Unless I'm mistaken, I think the compiler for regex currently works
> >at compile time, but not the matcher. Maybe someone who knows the
> >module could add support for that.
> 
> That's correct. I looked in to this a while ago and found out that the
> matcher uses @trusted code with pointers. Getting support for ctfe
> would require a rewrite of most of the matching engine and would
> probably result in a rather big performance hit.

An alternative would be to use `if (_ctfe)` branches in the code to
switch to a different matching engine when in CTFE, and leaving the
runtime code untouched.


T

-- 
Don't throw out the baby with the bathwater. Use your hands...


More information about the Digitalmars-d mailing list