Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatten mod scoping into root #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bheylin
Copy link
Contributor

@bheylin bheylin commented Nov 1, 2024

mod scoping is adding an unnecessary level to the mod hierarchy. It is true that the sub-modules are involved in 'scoping', but does that need to be taxonimized into the mod hierarchy? I argue that flattening the mod scoping into the parent mod reduces the complexity of the hierarchy without lossing meaning.

`mod scoping` is adding an unnecessary level to the mod hierarchy.
It is true that the sub-modules are involved in 'scoping',
but does that need to be taxonimized into the mod hierarchy?
I argue that flattening the `mod scoping` into the parent mod
reduces the complexity of the hierarchy without lossing meaning.
@alexpovel
Copy link
Owner

Sorry, I don't think I can agree. There's the two big themes of "actions" and "scoping" to srgn. While those are primarily end user-facing, I agree that doesn't necessarily have to be reflected in the source code, but why not? I don't see how it hurts.

Imports paths like use crate::scoping::scope::ScopeContext; are a bit crappy, I agree. That could be shortened to use crate::scoping::ScopeContext;, for example. However, the other paths make sense to me: there's scoping::regex, so that's clearly for scoping and not an action, or something auxiliary. Now there's just src/regex.rs, which loses that meaning. One could argue: Why not also flatten all actions as well at this point? That would be in the same spirit IIUC, but then it becomes pretty cluttered.

And languages are just a subcategory of scoping, which also makes sense in my mind. For example, it allows us to keep things like LanguageScoper in langs.rs.

@bheylin
Copy link
Contributor Author

bheylin commented Nov 3, 2024

Sorry, I don't think I can agree.

No need to be sorry, this is just how I try out ideas. I just make a PR and discuss it with the knowledge that it can be closed. I can handle being told "no" 😆

There's the two big themes of "actions" and "scoping" to srgn. While those are primarily end user-facing, I agree that doesn't necessarily have to be reflected in the source code, but why not? I don't see how it hurts.

Imports paths like use crate::scoping::scope::ScopeContext; are a bit crappy, I agree. That could be shortened to use crate::scoping::ScopeContext;, for example. However, the other paths make sense to me: there's scoping::regex, so that's clearly for scoping and not an action, or something auxiliary. Now there's just src/regex.rs, which loses that meaning. One could argue: Why not also flatten all actions as well at this point? That would be in the same spirit IIUC, but then it becomes pretty cluttered.

And languages are just a subcategory of scoping, which also makes sense in my mind. For example, it allows us to keep things like LanguageScoper in langs.rs.

The translation of taxonomic subcategories into namespaces is what I'm questioning.
But this is a suggestion, not something I feel strongly about.

The lang mod doesn't add value for me. LanguageScoper can just as easily live in scoping.rs and make as much sense.
If you apply the moduly_name_repetition clippy strictly. Types should not use the mod name as a prefix or postfix.
I take the view that the lang::LanguageScoper mod name repetition is a hint that it's in an overly specified/taxonimized namespace.

Maybe we could flatten langs into scoping?
If not, then I'll close the PR.

@alexpovel
Copy link
Owner

Maybe we could flatten langs into scoping?

That we could do, yes. Having e.g. python live next to regex is fine, or LanguageScoper directly in scoping.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants