Cranky:
I understand that problem too. How I handle entities (variables, constants, procedures, type names) is that I search for the first occurrence of the name in the current scope and parent scopes (normal scoping rules). So if an entity with the same name as an entity in a parent scope exists, it overshadows that parent entity. This is kind of how C works and lambda calculus.
| x: int
{
x: f32
x = 1 // refers to this scope's x of type `f32`
}
|
Adding overloading of certain entities would cause a weird edge case in which you would have to check
all parent scopes and find the
best match. This is certainly not a fast nor efficient method which would definitely slow compilation speed. I did actually implement half of overloading once and then removed it as it was just "ugly" to implement this edge case. I don't really want there to be a "special" namespace (except for file/global scope which is slightly different) either.
ratchetfreak's idea is a good middle ground: allowing for overloading of a particular entity without removing the simple namespacing rule.