antimony-lang/antimony

Struct methods

garritfra opened this issue · 1 comments

Assuming there is a Foo struct, this would be the method implementation for "some_method":

impl Foo.some_method(x: int) {
    self.bar = x
}

To call this method, a familiar syntax is used

fn main() {
    let some_foo = new Foo {
        bar: 5
    }

    some_foo.some_method(10)
}

Note: syntax has been adjusted. See documentation.