cairo
cairo copied to clipboard
feat: add function pointer
Feature Request
Describe the Feature Request
Cairo function pointer
Describe Preferred Solution
Like in Rust language ( https://doc.rust-lang.org/reference/types/function-pointer.html )
Describe Alternatives
Related Code
fn add(x: i32, y: i32) -> i32 {
x + y
}
let mut x = add(5,7);
type Binop = fn(i32, i32) -> i32;
let bo: Binop = add;
x = bo(5,7);
Additional Context
If the feature request is approved, would you be willing to submit a PR? (Help can be provided if you need assistance submitting a PR)
- [ ] Yes
- [X] No
Any specific reason you need it? (it is planned - but it is a huge and much more difficult feature than you might expect).
We are working on closures specifically - which should take care of a lot of the relevant usecases.