BioJulia / BioSequences.jl

Biological sequences for the julia language
http://biojulia.dev/BioSequences.jl
MIT License
152 stars 48 forks source link

Remove `convert` for biosequences #321

Open jakobnissen opened 2 days ago

jakobnissen commented 2 days ago

IMO, convert should not exist for mutable types (i.e. types with object identity), because it can be called implicitly, which can lead to very weird stuff:

julia> x = dna"TAG";

julia> y = [bioseq("TAG")];

julia> push!(y, x);

julia> y[2] === x
false
kescobo commented 2 days ago

I saw the slack gripe on this. Doesn't feel like a huge loss, especially if we put in constructors that can do the conversion for us (eg it would be nice to be able to "convert" RNA to DNA, but it could just be with a dna sequence constructor)

jakobnissen commented 2 days ago

Yep, the idea is to use the constructor instead. For immutable types (say, biosymbols) we can keep the conversion.