This is problematic because name resolutions happens far after macro
expansion. I think this could be doable with an extremely limited
"macro module system", but I think it's not-very-good to have the same
path syntax for two incredibly different systems.

On Tue, Feb 25, 2014 at 4:39 PM, Sean McArthur <[email protected]> wrote:
> Rust now has the ability to import macros from other crates, hurray!
> However, I'd like to propose adjusting the current way of using them to be
> more like importing/exporting other symbols of a crate.
>
> 1) It's more consistent, makes it easier to find where macros came from.
> 2) Current usage brings name collisions.
>
>
> Current example:
>
>     pub mod foo {
>       // assume other macros as well
>       #[macro_export]
>       macro_rules! bar ( ... )
>     }
>
>     pub mod baz {
>       // assume other macros as well
>       #[macro_export]
>       macro_rules! bar ( ... )
>     }
>
>     mod herp {
>       // i want bar! from foo, and some other macros from baz
>       [phase(syntax)]
>       use super::foo;
>       [phase(syntax)]
>       use super::baz;
>
>       pub Derp = bar!(); // which bar? is this an ICE? or logic error?
>     }
>
> Proposed example:
>
>     pub mod foo {
>       pub marco_rules! bar ( ... );
>     }
>
>     pub mod baz {
>       pub marco_rules! bar ( ... );
>       pub marco_rules! quux ( ... );
>     }
>
>     mod herp {
>       use super::foo::bar!;
>       use super::baz::quux!;
>       // using same name macros, no problem
>       use baz! = super::baz::bar!;
>
>       pub Derp = bar!(baz!());
>     }
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to