CTFE is getting too powerful :o)

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Mar 27 13:03:30 PDT 2013


27-Mar-2013 23:50, Nick Sabalausky пишет:
> 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.

That's far cry from full I/O ;)

In fact I believe we might need more general set of "built-in" functions 
for CTFE. The goal is to define as small set as possible covering as 
many good use-cases as possible.

And you still can't read/write to TLS global from CTFE for obvious reasons.

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


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list