CTFE: What limitations remain?

Steven Schveighoffer schveiguy at yahoo.com
Wed Jul 13 05:43:23 PDT 2011


On Wed, 13 Jul 2011 02:32:41 -0400, Dmitry Olshansky  
<dmitry.olsh at gmail.com> wrote:

> On 12.07.2011 18:22, dsimcha wrote:
>> The documentation for CTFE is outdated and specifies limitations that no
>> longer exist thanks to Don's massive overhaul.  For example, a big one  
>> is that
>> pointers now work.  What limitations that could potentially be removed  
>> still
>> do exist in CTFE as of 2.054?
> Just hited all of the below:
>      - try/catch
>      - intrinsics (bsr, bsf etc. ) this currently also means no Appender

Don has a patch for appender that allows it to work during CTFE:  
https://github.com/D-Programming-Language/phobos/pull/129

Actually, that was merged, prior to 2.054 release, may want to try  
appender again ;)

>      - array.reserve

array.reserve is specific to the GC, and the GC isn't the same during  
compile time.  Asking for this is like asking for GC.malloc.

However, if there ever was a working D compiler written in D, these kinds  
of things could be done no problem.  Reserve does seem like a useful thing  
to allow during CTFE.

Of course, I could change reserve to simply do nothing during ctfe, which  
would make things "work", even though reserving wasn't actually  
happening...

>      - foreach over tupple (aka static foreach)


More information about the Digitalmars-d mailing list