neo-go
neo-go copied to clipboard
Lambda support in compiler
This is a tracking issue for the tasks related to lambda support. Things, that need to be tested/implemented or made explicitly not supported:
I'd personally support only 4-th and as it can simplify contract code via some dynamic dispatching. Though even now this can be modelled via switch
/if
.
5-th can be useful for debugging.
All others are too complex to be used in any reasonable smart-contract.
- Declaring lambda inside of another lambda.
a := func(...) {
b := func(...) {
}
}
- Calling lambda function recursively.
var a func(int)
a = func(x int) {
...
return a(x-1)
}
- Redefining function variable inside of a function assigned to it.
var a func(int)
a = func(x int) {
...
if ... {
a = ...
}
}
- Assigning a function to a function variable
func f(int) {...}
...
var a func(int) = f
- Interop for calling arbitrary
[]byte
slice. This includes e.g. checking if allJMP*
s are hygienic, i.e. do not leave provided script.