Re: [rust-dev] Object system redesign

2011-11-11 Thread Niko Matsakis
On Nov 10, 2011, at 7:42 AM, David Rajchenbach-Teller wrote: - How do you compile the following extract? fn call_fooT(x: T) { x.foo(); } You don't. If you wanted to write `call_foo()`, you would probably write: iface has_foo { fn foo(); } fn call_foo(x: has_foo) {

Re: [rust-dev] Object system redesign

2011-11-11 Thread Patrick Walton
On 11/11/2011 07:29 AM, Niko Matsakis wrote: In principle, it might be nice to allow something like bounded polymorphism: fn call_fooT:has_foo(x: T) { x.foo(); } Without subtyping, it would make less sense. Perhaps it corresponds to passing the vtable that converts a `T`

Re: [rust-dev] Object system redesign

2011-11-08 Thread David Rajchenbach-Teller
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/8/11 5:18 PM, Patrick Walton wrote: The **new** keyword delimits the constructor inside the class declaration. It is not used to create instances of the class; rather, the class declaration results in the introduction of the constructor

Re: [rust-dev] Object system redesign

2011-11-08 Thread Graydon Hoare
On 08/11/2011 8:18 AM, Patrick Walton wrote: Hi everyone, I've been working on this for quite a while, and I think it's time to get it out in the open. I tried hard to keep this as minimal as possible, while addressing the very real issues in expressivity and developer ergonomics that we have

Re: [rust-dev] Object system redesign

2011-11-08 Thread David Herman
Just a couple detail responses: - Overall: technically strong proposal, but I'm lukewarm about doing it, and definitely don't want to *now*. In order, I'd prefer to finish what we've got scoped for the next while, then explore Niko's sketch, then get to this if we find it necessary. I

Re: [rust-dev] Object system redesign

2011-11-08 Thread Patrick Walton
On 11/8/11 9:12 AM, David Rajchenbach-Teller wrote: Does this mean that we can only have one constructor? If we wish to have several constructors – and if we accept that they must not have the same name – the class could yield a full module, in which each constructor is a function. Yeah, we

Re: [rust-dev] Object system redesign

2011-11-08 Thread Niko Matsakis
- The trait/class/interface split, while I think elegant and conceptually accurate when it comes to what's often under the covers in OO systems, is conceptually *heavy* to users: it makes you think an lot about OO-design-theory to write code in. It also carries a high engineering cost to

Re: [rust-dev] Object system redesign

2011-11-08 Thread Niko Matsakis
In case it's not clear, I should add that I like the proposal overall. It feels reminiscent of C++ in that you have fine-grained control over the costs of your abstractions but without the overwhelming complexity that C++ brings to the table. Niko On Nov 8, 2011, at 10:04 AM, Niko Matsakis