graydon/rust — Issue #1432: allow recursive object methods
Author: erickt
Created: 2012-01-05 00:20:18+00:00
State: open

It's a bit obnoxious when writing an object type that can return instances of itself that we need a tag to break up the recursion:

tag foo_tag = foo;

type foo = obj {
fn get_children() -> [foo_tag];
};

obj new_foo() {
fn get_children() -> [foo_tag] { [] }
}

It'd be much nicer if rust would just let us write `fn get_children() -> [foo]`.