-----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 into the module as a first-class function with bare
> function type and the same name as the class itself.

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.

> There is an alternate class form, **@class** (for example, `@class
> dog { ... }`), which has two effects:

What is the rationale behind **@class**?

> Destructors may not reference any data in the task heap, in order
> to disallow object resurrection.

So a destructor cannot trigger cleanup of any heap-allocated data?

> Class instances are copyable if and only if the class has no 
> destructor and all of its fields are copyable. Class instances are 
> sendable if and only if all of its fields are sendable and the
> class was not declared with **@class**.

No destructor? I would rather have guessed no constructor, what am I
missing?

> Classes may be type-parametric. Methods may not be
> type-parametric.

Hmmm... What is the rationale?


> ### Interfaces

I like it. Be warned that someone is bound to ask for RTTI to
pattern-match on interfaces and/or on interface fields.


> ### Traits

Ahah, I was just wondering if there were any plans for functors :)


> ### Scoped object extensions (concepts, categories)
> 
> Niko has a proposal for this, so I'll let him present it.


Generally, this looks very good.

One more question, though: what about class-less objects? I feel that
they could be quite useful to provide defer-style cleanup.

Cheers,
 David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOuWMUAAoJED+FkPgNe9W+Ml8H/2cBdFC3Uc6RYNFaNIFBjyYu
DKUUDDtDW/7TXns44RBEZtiR2whT+CSq5QdoDvs3DLYlaTl71kU0AwhjiDbYrU4b
WFom51ddJVZBpu0w/sLkmD6JCP/CY3nQ0QDhvtCqf0KnqKsq9DlKmPqFK3LOny51
IqS02tMBG1JK+77Lwuixdh0oNYBi+pCVCqlynioS+RRzlArTpwSniC7FEqrMcoz9
CL1OvYZ2OatbKuK+QDv/hE+HUuJLPK8CwkoBXPtDWADzc3EEa1mJSHRcjJuZuInK
m4p4blbrjuOB1Rs5faCo15F7raT5e+Re04edQAE3cTjeQhDiNMjhkYQUcO7U+Ug=
=gFHf
-----END PGP SIGNATURE-----
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to