www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - CTFE writeln

reply KennyTM~ <kennytm gmail.com> writes:
I've just opened a pull request* to enable std.stdio.writeln in CTFE. 
Any comments?

*: https://github.com/D-Programming-Language/dmd/pull/237
Jul 12 2011
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
KennyTM~:

 I've just opened a pull request* to enable std.stdio.writeln in CTFE. 
 Any comments?
 
 *: https://github.com/D-Programming-Language/dmd/pull/237
A tidy printing function is needed at CT, and the better CTFE becomes, the more need there is for it. I have suggested the "ctputs" name if it's simple (ctputs is supposed to work equally well at compile time and a run time!). But if you are able to implement the whole writeln, then calling it writeln is better, less names to remember and to use :-) A printing function is not just for debugging. Bye, bearophile
Jul 12 2011
prev sibling parent reply Brad Roberts <braddr puremagic.com> writes:
On 7/12/2011 1:20 AM, KennyTM~ wrote:
 I've just opened a pull request* to enable std.stdio.writeln in CTFE. Any
comments?
 
 *: https://github.com/D-Programming-Language/dmd/pull/237
Unless it supports everything that the runtime version does, using the same name is a bad idea, imho.
Jul 12 2011
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 7/12/2011 7:21 PM, Brad Roberts wrote:
 On 7/12/2011 1:20 AM, KennyTM~ wrote:
 I've just opened a pull request* to enable std.stdio.writeln in CTFE. Any
comments?

 *: https://github.com/D-Programming-Language/dmd/pull/237
Unless it supports everything that the runtime version does, using the same name is a bad idea, imho.
I agree with Brad, though I need to look at the actual pull request. There's also pragma(msg, "hello at compile time").
Jul 12 2011
parent "Nick Sabalausky" <a a.a> writes:
"Walter Bright" <newshound2 digitalmars.com> wrote in message 
news:ivj8t7$je7$1 digitalmars.com...
 On 7/12/2011 7:21 PM, Brad Roberts wrote:
 On 7/12/2011 1:20 AM, KennyTM~ wrote:
 I've just opened a pull request* to enable std.stdio.writeln in CTFE. 
 Any comments?

 *: https://github.com/D-Programming-Language/dmd/pull/237
Unless it supports everything that the runtime version does, using the same name is a bad idea, imho.
I agree with Brad, though I need to look at the actual pull request. There's also pragma(msg, "hello at compile time").
That's insufficient: enum x = foo("abc"); string foo(string a) { a ~= "def"; // printf-debug a CTFE: pragma(msg, "a: "~a); // <-- Big Fail return a; }
Jul 12 2011