CTFE: What limitations remain?
Dmitry Olshansky
dmitry.olsh at gmail.com
Wed Jul 13 08:38:45 PDT 2011
On 13.07.2011 16:43, Steven Schveighoffer wrote:
> 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 ;)
And I thought I was on a bleeding edge dmd, apparently I'm too slow to
pull these in time :)
>
>> - 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...
I'd say that would be an adequate workaround.
>
>> - foreach over tupple (aka static foreach)
Ok, so of all above try/catch is the last big thing.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list