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

Jonathan M Davis jmdavisProg at gmx.com
Tue Jul 12 17:52:04 PDT 2011


On 2011-07-12 15:50, Adam D. Ruppe wrote:
> I'd like to point out that *normal code* in Phobos is losing
> functionality far too often too, like replace() no longer working
> on immutable strings as of the last release.
> 
> Generalized templates are great, but not at the cost of existing
> functionality!

Please make sure that you report all such regressions. In some cases, they 
probably can't be fixed (especially if it's related to a compiler change which 
fixes something which shouldn't have worked before), but in a lot of such 
cases, it's likely simply because there wasn't a test case for it, and it 
wasn't caught.

As for immutable arrays, they're generally not going to work with range-based 
functions because of how templates work ( 
http://d.puremagic.com/issues/show_bug.cgi?id=6148 ). But if the change 
requested in http://d.puremagic.com/issues/show_bug.cgi?id=6289 is merged in, 
then slicing immutable arrays should work. Arguably however, most functions in 
std.array should work with immutable arrays (since it _is_ std._array_ after 
all), and if you can assume arrays rather than generic ranges, you can 
generally make them work with immutable arrays. So, replace may very well be 
fixed to work with immutable arrays. But if you don't point out such 
regressions, they don't necessarily get caught.

So, please point out such regressions in Phobos. That way they can be fixed 
and unit tests can be added to help ensure that they don't happen again.

- Jonathan M Davis


More information about the Digitalmars-d mailing list