On 03/12/2014 08:17 AM, Patrick Walton wrote:
On 3/12/14 3:29 AM, Nathan Myers wrote:
Given such primitives, esoteric constructions like virtual inheritance
could be left to ambitious users.
We did sketch a macro-based solution for this that was basically what
you said. It involved an `rtti!()` macro that allowed construction of
vtables per object and structs, as well as an `family!()` macro that
allowed you to downcast and upcast. But it was very complex, with lots
of moving parts. At the end of the day you need some things to be built
in to the language if you want them to be nice.
This is interesting because it means the work is half done.
Results of such an effort divide more or less neatly into
- essentials
- hacks around language limitations to implement essentials
- presentation hacks to make the construct usable by normal people
There's no getting around the first one; the complexity is in the
library or in the compiler. The latter two help to identify what
to add to the language core to make such a library practical.
The complexity of the features to eliminate the hacks would tend
to be much smaller than of the hacks themselves, and no larger
than pulling the whole into the core language. It would be tempting,
then, to generalize the new features to support more of the common
usage patterns (e.g. delegation), and it's a matter of project
discipline to know where to stop. Rust doesn't lack project
discipline.
Nathan Myers
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev