mod m {
pub func foo(label1: int);
}
mod n {
use m::foo;
func foo(label2: int);
}
Now, the importer operates on the names of item groups, i.e. in module m and in module n items with the name foo exist.
The module tree does not store direct information about suffixes, that is (label1:) and (label2:), thus in the importation of module m to module n the Importer tries to redefine function group foo rather than adds new overload foo(label1:).
What to do
Update Importer, change workflow for function overloads redefinitions:
Try to define name binding with name foo, if it wasn't a FOS (Function Overload Set) then it is an error
If the user tried to redefine FOS with new FOS -- check all overloads suffixes of redefined FOS and report an error with a collection of all redefined overloads
Why report an error with all redefined overloads? - It might be hard to comprehend the workflow if imported function overload overlaps one already defined in the module.
Alternative
Do nothing, disallow merging imported functions with already defined.
Let's begin with an example:
Now, the importer operates on the names of item groups, i.e. in module
m
and in modulen
items with the namefoo
exist. The module tree does not store direct information about suffixes, that is(label1:)
and(label2:)
, thus in the importation of modulem
to modulen
theImporter
tries to redefine function groupfoo
rather than adds new overloadfoo(label1:)
.What to do
Update
Importer
, change workflow for function overloads redefinitions:foo
, if it wasn't a FOS (Function Overload Set) then it is an errorWhy report an error with all redefined overloads? - It might be hard to comprehend the workflow if imported function overload overlaps one already defined in the module.
Alternative
Do nothing, disallow merging imported functions with already defined.