DConf 2014 Day 1 Talk 4: Inside the Regular Expressions in D by Dmitry Olshansky

Atila Neves via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jun 12 18:20:13 PDT 2014


On Thursday, 12 June 2014 at 08:42:49 UTC, Dmitry Olshansky wrote:
> 11-Jun-2014 22:03, Atila Neves пишет:
>> On Tuesday, 10 June 2014 at 19:36:57 UTC, bearophile wrote:
>>> At about 40.42 in the "Thoughts on static regex" there is 
>>> written
>>> "even compile-time printf would be awesome". There is a patch 
>>> about
>>> __ctWrite in GitHug, it should be fixed and merged.
>>>
>>> Bye,
>>> bearophile
>>
>> I wish I'd taken the mic at the end, and 2 days later Adam D. 
>> Ruppe said
>> what I was thinking of saying: unit test and debug the CTFE 
>> function at
>> runtime and then use it at compile-time when it's ready for 
>> production.
>>
>
> Yes, that's a starting point - a function working at R-T.
>
>> Yes, Dmitry brought up compiler bugs. But if you write a 
>> compile-time UT
>> and it fails, you'll know it wasn't because of your own code 
>> because the
>> run-time ones still pass.
>
> It doesn't help that it's not your fault :)
> And with a bit of __ctfe's to workaround compiler bugs you 
> won't be so sure of your code anymore.
>
>>
>> Maybe there's still a place for something more than pragma 
>> msg, but I'd
>> definitely advocate for the above at least in the beginning. If
>> anything, easier ways to write compile-time UTs would be, to 
>> me,
>> preferable to a compile-time printf.
>>
>
> There is nice assertCTFEable written by Kenji in Phobos. I 
> think it's our private magic for now but I see no reason not to 
> expose it somewhere.
>
>> Atila

It helps; you won't lose time looking at your code and wondering. 
I thought of the __cfte problem though: that would mean different 
code paths and what I said wouldn't be valid anymore.

Atila


More information about the Digitalmars-d-announce mailing list