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


_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to