CTFE is getting too powerful :o)

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Wed Mar 27 12:50:12 PDT 2013


On Wed, 27 Mar 2013 23:43:07 +0400
Dmitry Olshansky <dmitry.olsh at gmail.com> wrote:

> 27-Mar-2013 23:14, Peter Alexander пишет:
> > On Wednesday, 27 March 2013 at 14:48:32 UTC, Andrei Alexandrescu
> > wrote:
> >> Found this:
> >> http://stackoverflow.com/questions/15652718/object-error-access-violation-when-printing-result-of-std-algorithm-cartesianpr
> >>
> >>
> >> Soon we'll need to clearly define the limits of CTFE, and what
> >> happens when it fails.
> >
> > Aren't the limits just Safe D? (i.e. if it's in Safe D, it compiles,
> > anything more is implementation defined?)
> 
> No - one can call writeln (if one day it's marked @trusted). CTFE can 
> never do such a thing.

There's (thankfully) already a ctfeWriteln (or something like that). So
about all that needs to happen for writeln to work in CTFE is for it to
start with:

if(__ctfe) {
    ctfeWriteln(...);
    return;
}

Or something like that.

> Plus no access to globals etc. in general
> sense no side effects.
> 




More information about the Digitalmars-d mailing list