Compile-Time Sort in D

H. S. Teoh via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Jun 9 09:50:15 PDT 2017


On Fri, Jun 09, 2017 at 06:30:54PM +0300, ketmar via Digitalmars-d-announce wrote:
> Steven Schveighoffer wrote:
> 
> > At least in terms of i/o printing to the console or whatnot, it
> > would be cool to be able to do so at compile-time just directly with
> > writeln. As of now, a CTFE function can't call writeln, and it also
> > can't pragma(msg, ...) because it has to be written as a runtime
> > function.
> 
> yeah, `ctfeWriteln()`, even in very rudimentary form, will be
> priceless for debugging CTFE code. sure, CTFE code can be called in
> runtime and debugged, but sometimes it require alot of bouncing back
> and forth, like "let's replace all `enum` values with `auto` down the
> code, and then back", 'cause result of one CTFE call may be used in
> another CTFE call, and so on...

Yes, please add ctfeWriteln().

While D's CTFE capabilities are quite impressive even with today's CTFE
engine, and I'm sure it will be even more awesome with Stefan's new CTFE
engine, when things go wrong it's very hard to debug.  Ironically
enough, sometimes I find myself having to call the CTFE function at
runtime and debug that instead, before turning it back to a compile-time
call.

Having ctfeWriteln() would be a big help in making CTFE code easier to
debug. (Of course, there's also the CTFE debugger that Stefan alluded to
recently... while that would be even more awesome, I think ctfeWriteln
is easier to implement, so it's more likely to materialize in the near
future. :-P)


T

-- 
That's not a bug; that's a feature!


More information about the Digitalmars-d-announce mailing list