Merge the namespaces (at next epoch)
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
I have seen this on IRC today, written by @amaranth:
eval: u8::max_value()
Notice(eval): 255
eval: mod u8 { pub fn max_value() -> u32 { u32::max_value() } } u8::max_value()
Notice(eval): 4294967295
Given that modules and types have very different recommended naming scheme, I think it would make sense to merge these two namespaces by forbidding having a module with the same name as a type. This would require shuffling some things from the u8 module to the u8 type, I guess, but hopefully little that could break backwards-compatibility too much for an epoch.
As for the variables namespace, I guess it's a bit harder, given that the recommended naming scheme is the same as for modules. My perfectionist self would rather have it be merged with the others too with variables able to shadow modules, but it may be harder to pull out from a “let's not break too much retro-compatibility” perspective.
Finally, for the “Why?”, the reason is that separate namespaces:
- Make things tricky to learn (“wait so this is both a type and a module and a variable and a macro?”)
- Increase the attack surface for underhanded Rust code
What do you think about this?
Cheers,
Leo
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed Rust namespace changes in this issue, including module/type merging, variable shadowing, and epoch compatibility. Determine the compatibility and language-design implications, then document a resolved proposal or RFC with a clear decision on each namespace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100