You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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)
Instead of using the implicit convert method for mutable types like BioSequence, we could remove it to avoid confusion with object identity.
A recommended approach is to use explicit constructors for conversion, e.g., DNASequence(rna_seq) or RNASequence(dna_seq).
For immutable types like BioSymbols, keeping convert is fine since identity is not an issue.
Activity
kescobo commentedon Oct 23, 2024
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 commentedon Oct 23, 2024
Yep, the idea is to use the constructor instead. For immutable types (say, biosymbols) we can keep the conversion.
Bano733-code commentedon Nov 28, 2025
Instead of using the implicit convert method for mutable types like BioSequence, we could remove it to avoid confusion with object identity.
A recommended approach is to use explicit constructors for conversion, e.g., DNASequence(rna_seq) or RNASequence(dna_seq).
For immutable types like BioSymbols, keeping convert is fine since identity is not an issue.