Voldemort type "this" pointer
Mike Parker
aldacron at gmail.com
Wed Apr 21 10:47:08 UTC 2021
On Wednesday, 21 April 2021 at 10:00:51 UTC, realhet wrote:
> My question is about what is the "this" pointer for. Is it for
> storing the stack frame of the function in order to be able to
> serve queries that can lazily use the data from the stack frame?
>
> (I guess it's something else because that part of the stack
> might be undefined after exiting from the function.)
From the documentation
> 1. A nested struct is a struct that is declared inside the
> scope of a function or a templated struct that has aliases to
> local functions as a template argument. Nested structs have
> member functions. It has access to the context of its enclosing
> scope (via an added hidden field).
> 2. A struct can be prevented from being nested by using the
> static attribute, but then of course it will not be able to
> access variables from its enclosing scope.
https://dlang.org/spec/struct.html#nested
More information about the Digitalmars-d-learn
mailing list