Thread overview
[SAoC 2021] Replace druntime Hooks with Templates: Milestone 2, Week 1
Oct 22, 2021
Teodor Dutu
Oct 22, 2021
Imperatorn
Oct 24, 2021
Jack Applegame
October 22, 2021

Hi,

The objectives of this milestone is to reach and implement a decision for the _d_arrayctor lowering and to translate the lowerings to _d_arrayappendT and _d_arrayappendcTX into templates.

This week, I picked up Dan's work and started fixing the tests it fails. The issue i'm working on now is related to CTFE.
Dan's original work avoided rewriting any expressions to the CTFE stack in dinterpret.d, but this lead to compilation errors. I am currently working on adding CTFE support for lowerings to _d_arrayappendcTX, in a similar fashion to how Dan handled _d_arraysetlengthT.

In addition, my mentor Razvan has suggested a new approach for solving the issue caused by _d_arrayctor's purity. I mentioned this issue earlier in this post. This possible fix is to change _d_arrayctor's definition so as to lower expressions such as:

struct S {};
S[2] a;
immutable S[2] b = a;

to

immutable S[2] b = _d_arrayctor!(immutable(S[2]))(a)

instead of

immutable S[2] b;
_d_arrayctor(b, a);

This solution would keep _d_arrayctor pure while also making use of the value it returns. There are, however, still some points to talk clarify about this change.
For example, one is with regards to the length and overlap checks that the current implementation is performing. We're still unsure how to proceed about those.

Next week, my mentors and I will explore this new approach to _d_arrayctor further and I'll proceed to implement it once all questions have been answered. In addition, I will try to finish adding CTFE support for _d_arrayappendcTX and then move on to fixing the other failing tests.

Thanks,
Teodor

October 22, 2021

On Friday, 22 October 2021 at 22:18:22 UTC, Teodor Dutu wrote:

>

Hi,

The objectives of this milestone is to reach and implement a decision for the _d_arrayctor lowering and to translate the lowerings to _d_arrayappendT and _d_arrayappendcTX into templates.

[...]

👏

October 24, 2021

On Friday, 22 October 2021 at 22:18:22 UTC, Teodor Dutu wrote:

>

Hi,

The objectives of this milestone is to reach and implement a decision for the _d_arrayctor lowering and to translate the lowerings to _d_arrayappendT and _d_arrayappendcTX into templates.

[...]

Great!