Time for Phobos CTFE-ability unittests...right? RIGHT?

Nick Sabalausky a at a.a
Wed Jul 20 23:09:36 PDT 2011


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.1817.1311202371.14074.digitalmars-d at puremagic.com...
> On 2011-07-20 15:37, Don wrote:
>> Nick Sabalausky wrote:
>> > Yet again, a new DMD release has broken my code, and other people's 
>> > code,
>> > too, just because of Phobos functions loosing their CTFE-ability.
>> > (strip(), toLower(), etc... And yes, I did bring up the strip()
>> > regression on the beta list, to no effect.)
>>
>> The situation is, that prior to 2.054, use of Phobos in CTFE functions
>> has not been supported. No official statements have ever been made that
>> it was supported (and I've tried hard to publicize the fact that it was
>> not supported). There were some fundamental wrong-code bugs and severe
>> limitations in CTFE. And so although some Phobos functions seemed to
>> work in CTFE, most of them were not correct.
>> So, any Phobos function which used to work in CTFE in some old release
>> but doesn't any more is not a regression. It was just dumb luck, relying
>> on undefined behaviour, if any happened to work in a particular release.
>>

Ok, I see. I guess I must have missed that.

>> This has changed with 2.054. Although there are still some restrictions
>> (no classes, many builtin functions aren't implemented), the fundamental
>> wrong code bugs are fixed. So any Phobos function which works in CTFE in
>> 2.054, but fails in a future release, can be considered a regression.
>> We are now in a _completely_ different regime.

Glad to hear it!

>
> If that's the case, then we should look at adding CTFEability tests to at
> least some portion of Phobos.
>

Totally agree. I think string-processing and anything else likely to be 
needed in string metaprogramming (such as to!string(int) and to!int(string)) 
would be the most important ones.




More information about the Digitalmars-d mailing list