Closed
Description
For the reasons discussed in this forums thread it would be slightly advantageous to make the Complex type and module have different names. This requires renaming one of them.
This would allow people who want to work with a single concrete complex type to do something like:
typealias Complex = ComplexType<Float> // if we rename the type
typealias Complex = ComplexModule.Complex<Float> // If we rename the module
They would then still be able to get at the generic type as either ComplexType
or ComplexModule.Complex
.
As you can see, renaming the type makes this specific use case a tiny bit neater, but makes the normal generic usage a tiny bit messier (while renaming the module only changes the import statement in routine use, which is less invasive).
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
stephentyrone commentedon Jan 21, 2020
More generally, I would like to establish a general policy for how to handle this situation, as I expect it to come up repeatedly in Swift Numerics.
xwu commentedon Jan 21, 2020
My vote is for renaming the module. There is little precedent for appending
Type
at the end of names for generic types, but plenty of precedent for seeking out unique module names, which are essentially not at all constrained by naming guidelines.varungandhi-apple commentedon Jan 22, 2020
I think that it would make more sense to rename the module, since one is more likely to spell out the type more often (especially if one is writing generic code), and so having
ComplexType<..>
in many places makes it a little tedious to skim.stephentyrone commentedon Jan 22, 2020
@xwu That's basically my feeling as well (but:
Type
is purely a strawman suffix here; if someone had a good proposal for a suffix that made more sense, I would consider it).benrimmington commentedon Jan 22, 2020
I also think renaming the modules is better, especially if they will migrate into the standard library.
You could use a three letter prefix (similar to the SwiftNIO modules):
You could use the "Swift" prefix:
stephentyrone commentedon Jan 24, 2020
Draft PR using "Numerics" as a placeholder module prefix here: #97
stephentyrone commentedon Apr 13, 2020
Resolved in 0.0.5 by adding the disambiguating Module suffix to Real and Complex.