On Thu, Feb 28, 2013 at 8:46 PM, Graydon Hoare <[email protected]> wrote:
> On 28/02/2013 10:50 AM, Graydon Hoare wrote:
>
>>     get away with doing this (in libstd):
>>
>>         #[vers="1.0.0"]
>>         pub mod foo = "github.com/user/foo#1.0";
>>
>>         #[vers="1.1.0"]
>>         pub mod foo = "github.com/user/foo#2.0";
>
> Also note: in case this sounds too terrifying in terms of hacking a new
> sub-dimension onto resolve, not to mention figuring out how to
> (automatically?) transform minor-version bumps in the 1.x and 2.x series
> of libfoo into corresponding minor-version bumps in libstd, this could
> equally be accomplished manually / by convention, in terms of:
>
>          pub mod foo_v1 = "github.com/user/foo#1.0";
>          pub mod foo_v2 = "github.com/user/foo#2.0";
>          pub mod foo {
>              pub use foo_v1::*;
>          }
>
> or even possibly
>
>          pub mod foo {
>              pub mod v1 = "github.com/user/foo#1.0";
>              pub mod v2 = "github.com/user/foo#2.0";
>              pub use foo::v1::*;
>          }
>
> assuming foo doesn't define names v1 and v2 itself (unlikely). Our
> module system is quite strong when it comes to rebinding names. Doing it
> this way just involves more legwork. But it might be desirable from a
> "minimizing cognitive load" perspective to make this explicit in the
> code and avoid having to reason about versions when thinking about what
> resolve is doing.
>
> -Graydon

This sounds a lot like what C++ is doing with inline namespaces:
http://stackoverflow.com/a/11018418


-- 
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