Closed ghost closed 8 years ago
Looks like you wanted to post this elsewhere, because I could not understand a thing.
No, this is the correct repo 😆
What I meant was, is there a way to execute user code periodically, which accesses some state that is not declared globally? The callback passed to timers.setInterval
neither takes a parameter nor is it a closure. The first bullet point might be the wrong approach, because I'm not sure how that would translate to browser applications for example.
Does it make sense now?
timers.setInterval
takes a closure as argument.
var i = 0
setInterval(1.0) do():
inc i
echo i
I thought it was necessary to annotate the parameter with the closure
pragma.
Won't the function where setInterval
is invoked go out of scope before the event loop is executed?
I thought it was necessary to annotate the parameter with the closure pragma.
Proc args are closures by default.
Won't the function where setInterval is invoked go out of scope before the event loop is executed?
Sorry, but I don't understand the question again. setInterval
schedules a timer in runloop. Why would scope matter?
nevermind
If indeed it's not possible, then some ways to deal with this includes: