-
Notifications
You must be signed in to change notification settings - Fork 149
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
Enable name lookup for modules by suffixing Module
when needed to break ambiguity.
#97
Conversation
Would "Numerics" as a suffix ("ComplexNumerics" and "RealNumerics") read more natural? |
I think so, but it would be less closely in line with NIO. Worth discussing! I think there's a few good options including a three-char prefix, and the suffix that's literally just "module" (this might work better with things like "ShapedArray". I slightly prefer "ShapedArrayModule" to "ShapedArrayNumerics".) |
Um... i think putting an underscore in the middle is not swifty. I've never seen a project named like this. |
https://github.com/apple/swift-standard-library-preview In particular, Basically, here are the possibilities I've considered:
(3) is arguably the most "swifty", in that the majority of swift code written to date is for Apple platforms and mostly-follows Objective-C prefix conventions. (1) and (2) are good because they avoid abbreviations, but they don't do a good job of differentiating between the prefix and the "base" module name. (4) is explicit and makes clear that (5) is probably a little too cute. It works great with (6) is fairly attractive to me, because it's also very clear what's going on, and we could also adopt the rule that you only need to have the suffix when there's a clash to be avoided. So we would have e.g. |
Is it possible to use "Num" as a prefix?
|
I like that option; it's like how we have a rule about |
Yeah, this seems like the best approach to me now. |
Module
when needed.
Module
when needed.Module
when needed to break ambiguity.
Ideally we'd be able to use Numerics.Module instead of underscore, but we can't always get what we want.
ef58325
to
014ce56
Compare
In particular, the following module renames are applied:
Real
->RealModule
Complex
->ComplexModule
This is a source-breaking change, if you currently directly import these modules. (sorry!)
The fix is to either import
Numerics
instead, or to use the new, suffixed, names. The good news is that fixing this should require only a straightforward search-and-replace for anyone affected.Some context for why I'm making this change can be found here. There are a few other use patterns that are enabled by this change, all tied into the same name lookup issue.