Can we allow re-opening modules several times?

Currently, the following code causes a “duplicate module” error:

mod foo
{}

mod foo
{}

Is there a strong reason to forbid re-opening a module (as long as it’s in the same crate)?

The reason I am asking is that if this were allowed, it would ease the pain stemming from inability to generate composite item identifiers in macros. Sometimes it is necessary to generate several items based on the same identifier (passed as macro parameter), but it’s very hard to avoid name collisions because concat_idents!() doesn’t work in the item ident position. It is often possible to avoid collisions by showing “secondary” items into a submodule, but this approach runs into the above error if one uses the macro twice.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.