Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 21, 2011 [Issue 5632] New: replace() not evaluatable at compile-time anymore | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5632 Summary: replace() not evaluatable at compile-time anymore Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: mrmocool@gmx.de Depends on: 4047 --- Comment #0 from Trass3r <mrmocool@gmx.de> 2011-02-21 08:14:29 PST --- As of 2.052 replace() has moved to std.array and uses Appender. Thus it isn't evaluatable at compile-time anymore because Appender uses a pointer to a struct. import std.array; int bla() { "aa".replace("aa", "bb"); return 0; } enum blub = bla(); C:\dmd\windows\bin\..\..\src\phobos\std\array.d(1051): Error: Cannot interpret new Data at compile time C:\dmd\windows\bin\..\..\src\phobos\std\array.d(1331): Error: cannot evaluate (Appender!(string) __ctmp1239 = 0; , __ctmp1239).this(array) at compile time C:\dmd\windows\bin\..\..\src\phobos\std\array.d(884): Error: cannot evaluate appender(null) at compile time replacectfe.d(6): Error: cannot evaluate replace("aa","aa","bb") at compile time replacectfe.d(10): Error: cannot evaluate bla() at compile time replacectfe.d(10): Error: cannot evaluate bla() at compile time -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 21, 2011 [Issue 5632] replace() not evaluatable at compile-time anymore | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=5632 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2011-02-21 09:46:52 PST --- String functions are better if they are evaluable at compile-time, but currently there is no requirements for the standard library to be CTFE. So I think this is an enhancement request and not a bug. A simple way to solve this problem is to use __ctfe, to add to replace() another algorithm fit for run-time. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 21, 2011 [Issue 5632] replace() not evaluatable at compile-time anymore | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=5632 --- Comment #2 from Trass3r <mrmocool@gmx.de> 2011-02-21 10:25:05 PST --- Yeah, I know it is no requirement. On the other hand you could also see it as a regression since replace was CTFE-able before ;) But I agree, string functions should be available at compile-time because we need it for string mixins. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 03, 2011 [Issue 5632] [CTFE] replace() not evaluatable at compile-time anymore | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=5632 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |FIXED Summary|replace() not evaluatable |[CTFE] replace() not |at compile-time anymore |evaluatable at compile-time | |anymore --- Comment #3 from Don <clugdbug@yahoo.com.au> 2011-07-02 23:46:40 PDT --- https://github.com/D-Programming-Language/phobos/commit/337a6182d33b43e80a82a052d63ff1118ff39116 (together with the DMD changes which make this possible). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation