518dc52f85
This changes the indexing syntax from .() to [], the vector syntax from ~[] to [] and the extension syntax from #fmt() to #fmt[]
20 lines
278 B
Rust
20 lines
278 B
Rust
|
|
|
|
type adder =
|
|
obj {
|
|
fn add();
|
|
};
|
|
|
|
obj leaf_adder(x: int) {
|
|
fn add() { log "leaf"; log x; }
|
|
}
|
|
|
|
obj delegate_adder(a: adder) {
|
|
fn add() { a.add(); }
|
|
}
|
|
|
|
fn main() {
|
|
let x = delegate_adder(delegate_adder(delegate_adder(leaf_adder(10))));
|
|
x.add();
|
|
}
|