CTFE Overhaul (Was: RFC: Thrift project proposal (draft))

David Nadlinger see at klickverbot.at
Sat Mar 26 14:14:53 PDT 2011


On 3/26/11 9:59 PM, David Nadlinger wrote:
> On 3/26/11 9:16 PM, Don wrote:
>> The basic problem with the current implementation of CTFE is that it
>> uses copy-on-write. This means that references (including dynamic
>> arrays) don't work properly -- they just copy a snapshot of the thing
>> they are referencing. This is bug 1330. It also means it burns up memory
>> like you wouldn't believe.
>>
>> I'm changing CTFE to use in-place modification. This fixes all those
>> issues. But this is obviously a fairly intense change, and will take
>> quite a lot of time to iron out all the corner cases. So that's all I'm
>> planning on doing right now.
>>
>> But once that's done, it will be straightforward to implement other
>> reference types, such as classes and pointers (pointer arithmetic will
>> be restricted to pointers which point to array members). Once classes
>> are implemented, it's straightforward to do exceptions. So, pretty much
>> everything.
>
> […]
>
> Do I understand correctly that your changes wouldn't introduce some form
> of real compile-time memory management, but alleviate the need for it by
> fixing bug 1330 and related ones, thus cutting down on the ridiculous
> amount of copying going on today?

Ah, forget that part, I wasn't aware of David's post asking the same 
question (and your answer to it) when I wrote this message.

David


More information about the Digitalmars-d mailing list