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

Reply via email to