[OT] web assembly memory model

Walter Bright newshound2 at digitalmars.com
Sun Jan 4 05:28:02 UTC 2026


On 1/3/2026 7:30 PM, Richard (Rikki) Andrew Cattermole wrote:
>> I don't see why calls to `new` cannot be redirected to whatever WASM does?
> 
> You can't do pointer arithmetic with WasmGC.
> No subtraction, no getting pointers to fields, nothing like that.
> That is the GC offering currently.

```
struct S { int a; }
S* s = new S();
s.a = 3;
```

What's the problem?

> For the linear memory, its a memory mapper only, sbrk.
> Oh and you can have multiple linear memories that you have to keep track what 
> the offset is actually for when dereferencing.

I don't get it.

> They are typed entirely differently, you cannot mix them.
> It is exactly like near vs far pointers.

??



More information about the Digitalmars-d mailing list