From 7d56bbe84d52311a39e97532d9f210ee3f0036c1 Mon Sep 17 00:00:00 2001 From: Jakob Nybo Nissen Date: Sat, 14 Oct 2023 20:11:20 +0200 Subject: [PATCH] Remove State struct 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. --- Project.toml | 6 ++---- src/Automa.jl | 16 ---------------- src/BioGenerics.jl | 4 ---- 3 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 src/Automa.jl diff --git a/Project.toml b/Project.toml index ff27975..0581134 100644 --- a/Project.toml +++ b/Project.toml @@ -1,10 +1,9 @@ name = "BioGenerics" uuid = "47718e42-2ac5-11e9-14af-e5595289c2ea" -authors = ["Ben J. Ward "] -version = "0.1.4" +authors = ["Sabrina J. Ward ", "Jakob N. Nissen "] +version = "0.2.0" [deps] -TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -14,4 +13,3 @@ test = ["Test"] [compat] julia = "1.0" -TranscodingStreams = "0.9, 0.10" diff --git a/src/Automa.jl b/src/Automa.jl deleted file mode 100644 index 922cec3..0000000 --- a/src/Automa.jl +++ /dev/null @@ -1,16 +0,0 @@ -module Automa - -import TranscodingStreams: TranscodingStream - -mutable struct State{S <: TranscodingStream} - # Stream - stream::S - # Machine state - state::Int - # Line number - linenum::Int - # Is record filled? - filled::Bool -end - -end # module \ No newline at end of file diff --git a/src/BioGenerics.jl b/src/BioGenerics.jl index 4e1803c..fdc49d3 100644 --- a/src/BioGenerics.jl +++ b/src/BioGenerics.jl @@ -10,11 +10,7 @@ module BioGenerics include("methods.jl") include("Exceptions.jl") -include("Automa.jl") include("IO.jl") -#include("Mem.jl") -#include("ReaderHelper.jl") -#include("RecordHelper.jl") include("Testing.jl") using .IO: readertype, writertype, @rdr_str, @wtr_str