Let's get the semantic around closure fixed.
Ola Fosheim Grostad
ola.fosheim.grostad at gmail.com
Tue May 18 19:32:11 UTC 2021
On Tuesday, 18 May 2021 at 19:20:55 UTC, Steven Schveighoffer
wrote:
> On 5/18/21 3:04 PM, Ola Fosheim Grostad wrote:
> There's also the issue that if you have a scoped variable that
> has a destructor, the value will be destroyed (and probably
> unusable) if you call the delegate from outside the scope.
Ouch. Ok, so in OO languages like Simula, all scopes are
heap-closures and there is no stack, which kinda changes the
game. I guess Javascript does the same conceptually but the JIT
perhaps extracts uncaptured variables and puts those on a stack
as an optimization? (My guess)
But how does a function with a delegate parameter know if it is
safe to store the delegate or not?
More information about the Digitalmars-d
mailing list