pathologically simple hotloading RE: compiler bugs
monkyyy
crazymonkyyy at gmail.com
Mon Jun 8 23:36:50 UTC 2026
On Sunday, 7 June 2026 at 21:38:23 UTC, monkyyy wrote:
> On Saturday, 6 June 2026 at 00:11:39 UTC, monkyyy wrote:
>> I have not yet written it but I should be able to avoid
>> ctfe-gc landmines to produce an appendable enum-ish string[];
>
> my current progress on improving my ct utilities, this alone
> was a nightmere
>
> ```d
> import std;
>
> enum pointer=cast(immutable(void)*)[0].ptr;
> template changepointer(alias p){
> enum changepointer=(){
> *(cast(int*)pointer)+=*cast(int*)p;
> return 1;
> }();
> }
> unittest{
> (*(cast(int*)pointer)).writeln;
> enum immutable(void)*
> newpointer=cast(immutable(void)*)[5].ptr;
> enum _=changepointer!(newpointer);
> }
> ```
>
> the ctfe gc is even more fickle then I remember, I think int
> and void is the special case
>
> I think I can make a reverse linked list given only mutable
> void* pointers but Im more open to suggestions
>
> if that fails then I would have to resort to appendable
> aliasseq of aliased strings and that **doesnt** have a clean
> way to communcate to post-compiletime that I know of
>
> I want void*[] to be my hotloading primitive type
The if you manage to dodge all the safetys on the ctfe gc, you
get segfualts or maybe the compiler gets confused and cant link a
linked list of enums, idk; either way that direction was a dead
end as far as I can tell, I believe static this spam maybe the
lowest cost option for value
```d
import std;
int[] hi;
template foo(alias a){
static this(){
hi~=a;
}
enum foo=0;
}
enum _1=foo!1;
enum _2=foo!2;
unittest{
hi.writeln;
}
```
More information about the Digitalmars-d-learn
mailing list