[rust-dev] Naming conventions for constructors

Erick Tryzelaar erick.tryzelaar at gmail.com
Tue Aug 14 18:04:26 PDT 2012

On Tue, Aug 14, 2012 at 4:35 PM, Brian Anderson <banderson at mozilla.com> wrote:
> Hey.



> Then to use it:
>     import my_crate::belt_buckle;
>     let my_belt_buckle = belt_buckle::new();
> You will mostly not import the constructor because it will need to be
> disambiguated from all the other 'new's in the world.

This is fine with me, I liked this style back in the pre-typeclass
rust. There were two things that bugged me about this style. First,
impls made import lines pretty dense, so it was nice to just import
one type/impl/fn. Is this still the case with the new min/max classes?
Second, If I wanted to import anything from the module, I'd have to

import my_crate::belt_buckle;
import my_crate::belt_buckle::BeltBuckle;

Maybe we could add some sugar to combine those two lines into (forgive
me if there's already a way to do this):

import my_crate::belt_buckle::{., BeltBuckle};

More information about the Rust-dev mailing list