Random D geekout

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Apr 21 07:41:00 PDT 2012


On Sat, Apr 21, 2012 at 03:12:05PM +0400, Dmitry Olshansky wrote:
> On 21.04.2012 14:48, SomeDude wrote:
> >On Saturday, 21 April 2012 at 10:21:49 UTC, Dmitry Olshansky wrote:
> >>Just stop using ctRegex for now... it's experimental.
> >>
> >>Or more to the point the problem is this. I've seen this one on bugzilla:
> >>
> >>version(CtRgx) {
> >>enum Re = ctRegex!re;//auto is OK here BTW
> >>} else {//that's the problem. It's _parsed_ at compile-time
> >>static Re = regex(re);//switch static to auto
> >>}
> >>}
> >>
> >>And there is little I can do untill CTFE stops bleeding RAM.
> >
> >Well, neither of those works:
> >
> >version(CtRgx) {
> >auto Re = ctRegex!re;//auto is OK here BTW
> >} else {//that's the problem. It's _parsed_ at compile-time
> >auto Re = regex(re);//switch static to auto
> >}
[...]

Hmph. I should've checked dmd memory usage when I wrote that. :-(

But anyway, even on my souped up AMD hexacore system, the ctRegex
version takes significantly longer to compile than the non-ctRegex
version. Perhaps I should just avoid ctRegex for now (though it *is* an
ultracool feature of std.regex).

I'm getting confused about the use of 'static' in this context. What I
wanted was to make the regex module-global, but apparently 'static' has
an overloaded meaning here, and also makes it compile-time evaluated?
How do I make it module-global without being compile-time evaluated??


T

-- 
"You know, maybe we don't *need* enemies." "Yeah, best friends are about all I can take." -- Calvin & Hobbes


More information about the Digitalmars-d mailing list