-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Create top-level types.go
to define types shared across packages
#347
Comments
This is gonna be entirely unhelpful, but lemme just put some comments below -
Now, opinions on types in general:
|
Just addding my 2 cents on this, I think it'd be nice to have a package with a good name that has a clear scope (so not named The reason why is articulated well here
It would be good to at least Alias the different sequences to make function signatures clearer and make it impossible to use the wrong sequence type, aka instead of Translate(string) Translate(dna.Sequence) You can put the parsers in those packages to get nice semantics too (e.g A type alias allows you to keep both Ultimately though I suspect it would be nicer (but a lot harder) to have a |
I also think I agree that methylationSites should be separate - perhaps like For the sequence itself - I'm not sure if a |
I agree with @cachemoi regarding package names like We do have a sub package called As far as sharing types between packages are there any pressing corner cases where we need to do this? It's an interesting thought but right now I don't think there's anything that's particularly broken. |
Also agreed re: avoiding
This could be solved using Go's interfacing system I think. Something like this would go in the root of the package in
Then, client packages can compose the interfaces to specify what functionality it is they need from that |
This issue has had no activity in the past 2 months. Marking as |
Is your feature request related to a problem? Please describe.
As
poly
grows, more and more types will be shared between nominally unrelated packages.For example, many packages will deal with sequences. Currently, we use the
string
type to represent sequences in most of the packages. However, sequences often also need to be annotated with whether they are circular or linear, as is already done in theclone
package and as we are considering doing to resolve #225 :https://github.com/TimothyStiles/poly/blob/10b8f398c4272700dd27a177af244d6b531d2582/clone/clone.go#L56-L63
Describe the solution you'd like
A new file (
types.go
) in the root of the repository that defines types commonly used across packages. Whenever it feels like you're reusing a similar struct or interface across packages, it should be placed in said file.Describe alternatives you've considered
types
orcommon
)poly
into more specific packages that share common typessequence
. Anything that deals with structural info will be put in the packagestructure
. These packages will have a top-leveltypes.go
file that contains shared types.poly
, but I still think this needs addressing.The text was updated successfully, but these errors were encountered: