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

Remove State struct #17

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

Conversation

jakobnissen
Copy link
Member

The State struct is presumably intended to be used by users of Automa, such that all the information related to the state of an Automa machine, which needs to be stored in a BioJulia Reader type, is implemented one place. Presumably, the idea was that it would make it easier for users to reason about what is needed when implementing a reader.

However, it's not a good idea for several reasons:

  1. It hardly makes it easier to reason about that users need to bring in this package in order to store a state related to Automa - if this struct should exist at all, it should be in Automa.jl
  2. It's debatable what kind of information needs to be stored, and this also depends on the specific reader type. For example, FASTX does not need to to store the filled::Bool field.
  3. It's easier to reason about for users and authors if all state related to a reader is stored in the reader itself, instead of in a field defined in another package
  4. This forces a dependency on TranscodingStreams on this package, which is unnecessary for most users of BioGenerics.

Fixes BioJulia/Automa.jl#103

Broader considerations

See the comment here: BioJulia/Automa.jl#103 (comment) . @TransGirlCodes suggested removing this entire package, but I kind of like #14 (even though it needs to be reworked because I've found out macros don't support interpolating, but that's another story), and I can't really think of any other place to add these definitions. Maybe it's fine to have this as a very lightweight, zero dependency package that defines common supertypes and interfaces.
Looking through the code of BioGenerics, really it's only the code in the IO module I feel like we need to keep.
For now, let's just remove the TranscodingStreams dependency. Since this package is not user-facing, we can break the API as much as we want, so I don't think we need to lose any sleep about making yet another breaking release.

Comments welcome - @BioJulia/maintainers

The State struct is presumably intended to be used by users of Automa, such that
all the information related to the state of an Automa machine, which needs to be
stored in a BioJulia Reader type, is implemented one place.
Presumably, the idea was that it would make it easier for users to reason about
what is needed when implementing a reader.

However, it's not a good idea for several reasons:
1. It hardly makes it easier to reason about that users need to bring in this
   package in order to store a state related to Automa - if this struct should
   exist at all, it should be in Automa.jl
2. It's debatable what kind of information needs to be stored, and this also
   depends on the specific reader type. For example, FASTX does not need to
   to store the `filled::Bool` field.
3. It's easier to reason about for users and authors if all state related to a
   reader is stored in the reader itself, instead of in a field defined in
   another package
4. This forces a dependency on TranscodingStreams on this package, which is
   unnecessary for most users of BioGenerics.
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.

Revamp BioGenerics.Automa.State: Recoverable readers
1 participant