mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
82be43f4e6
This is a common operation:
freevar := ...
defer func() {
println("I am deferred:", freevar)
}()
The function is thus an immediately applied closure. Only this form is
currently supported, support for regular (fat) function pointers should
be trivial to add but is not currently implemented as it wasn't
necessary to get fmt to compile.
9 lines
176 B
Plaintext
9 lines
176 B
Plaintext
hello from function pointer: 5
|
|
deferring...
|
|
...run as defer 3
|
|
...run closure deferred: 4
|
|
...run as defer 1
|
|
bound method: foo
|
|
thing inside closure: foo
|
|
inside fp closure: foo 3
|