CTFE writeln again (__ctfeWriteln)

KennyTM~ kennytm at gmail.com
Mon Aug 8 00:11:46 PDT 2011


On Aug 8, 11 06:45, bearophile wrote:
> KennyTM~:
>
>> __ctfeWrite is not complex, but I don't see the need for it.
>
> I don't understand your point. Given __ctfeWrite you are able to create a __ctfeWriteln but you can't do the opposite.
>
> If I have to print something complex, like something tree-shaped, and I have just __ctfeWriteln, to create the printing I need to first put everything into a huge string, and print it. If I have __ctfeWrite I am able to write it one bit at a time.
>
> Not having a compulsive newline was the strongest requirement in my original enhancement request:
> http://d.puremagic.com/issues/show_bug.cgi?id=3952
>
> The obligatory newline of pragma(msg) has given me several problems, it's much less useful because of this.
>
> Bye,
> bearophile

I understand that you could implement `writeln` in terms of `write`, but 
I question its practical value.   Why do you need to print a tree at 
compile time?  pragma(msg) and __ctfeWriteln are mainly for debugging, 
and adding a newline is very suitable (e.g. it won't mess up the error 
message in the next line).


More information about the Digitalmars-d mailing list