Editions Ideas
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Thu Dec 18 06:45:52 UTC 2025
On 18/12/2025 7:32 PM, Kapendev wrote:
> On Thursday, 18 December 2025 at 05:57:35 UTC, Walter Bright wrote:
>> On 12/16/2025 1:12 PM, jmh530 wrote:
>>> The idea is that functions include "a pointer to the current context
>>> as an implicit additional argument.". It looks to be helpful with
>>> managing allocators.
>>
>> That sounds like member functions?
>
> Yes, kinda, but it's copy-on-write.
> One issue with that system is handling static constructors, plus dealing
> with an extra calling convention.
There is a fairly straight forward way to do this, without adding
specific library into the language.
To borrow an idea for Swift, use a TLS variable as the bottom of the stack.
```d
Something* something;
void userFunc() {
// Something __temp = Something(something);
// something = &__temp;
// scope(exit) something = __temp.parent;
something.cool(); // actually __temp.cool();
}
```
Implicit temporaries for globals.
More information about the Digitalmars-d
mailing list