chunkBy array at compile time

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Dec 19 19:41:37 UTC 2018


On Wed, Dec 19, 2018 at 02:01:28PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote:
> On 12/19/18 1:30 PM, H. S. Teoh wrote:
[...]
> > For CTFE, though, we don't really care about calling popFront twice,
> > so I surmise that we should be able to just use the original
> > non-RefCounted implementation. It's not hard, just take out the bits
> > where the subranges communicate with the outer range, and just have
> > each subrange carry its own instance of the underlying range.  It
> > will incur some CTFE performance hit, but that's better than not
> > being CTFE-able at all.
> 
> There is a problem here though -- CTFE must compile the same
> (essentially) as normal runtime. We can make different code paths for
> CTFE, but the problem I see in the meantime is that the TYPE must be
> the same.
> 
> In other words, the CTFE version shouldn't use RefCounted, but the
> type already has that in there.
> 
> I also see some bad things happening if initialized at compile time
> via CTFE, but then used at runtime. But I don't know if that works or
> not.
[...]

Hmph.  This is an annoying limitation. :-/  And one of the major
downsides of using RefCounted in the implementation. :-(


T

-- 
It's bad luck to be superstitious. -- YHL


More information about the Digitalmars-d-learn mailing list