On Wed, May 29, 2013 at 11:53 PM, Graydon Hoare <[email protected]> wrote:

> On 13-05-29 02:40 PM, Gábor Lehel wrote:
> > Maybe I'm unusual. But in C++ I'm always super-careful (one might say
> > anal retentive) about keeping my headers as clean of implementation
> > details as humanly possible. I don't think forgetting a `priv` would
> > ever be an issue. But I'm not everyone.
>
> Because Rust does not differentiate between "header" and
> "implementation" -- the signatures and metadata are extracted from the
> program and compiled-in to the resulting binary -- our experience when
> "everything was public" (as it once was, briefly) was that everything
> got exported. People just didn't notice all the things they were
> exporting, or deferred having to think about it.
>
> At a different time, we had explicit export lists, and a sort of "phase
> transition" when developing a library: everything was exported when you
> mentioned nothing and were just doing sketches; but as soon as you
> mentioned exports, _only_ those things were exported.
>
> This facility was removed when we switched to pub and priv, on the basis
> that people complained about having to scroll up and down the screen
> looking for the export list.
>
> I think there is no perfect answer here. I'm sympathetic to your
> concerns ('pub' was chosen as small as possible, to minimize these
> costs) but I think that making everything public by default is a major
> hazard for growing private-API dependencies, and would not want us to go
> there.
>
> -Graydon
>
>
My proposal does rest on the assumption that module authors know what
they're doing and wouldn't leave things exported accidentally (won't the
exported items showing up in the generated docs dissuade them, at least?),
but if that's not true then I agree the proposal is much less attractive.

-- 
Your ship was destroyed in a monadic eruption.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to