Passing method references to high-order functions
I would like to pass a reference to a method once the object has been instanciated to a high-order function as an argument, but it seems not supported, right?
Example:
Example:
@value
struct Foo:
fn func(self) -> Int:
return 42
# None of these declarations work:
fn high_order_func(f: fn (Foo) -> Int) -> Int:
# fn high_order_func(f: fn () -> Int) -> Int:
return f()
fn main() -> Int:
foo = Foo()
print(high_order_func(foo.func))