Skip to content

Do not suggest convert in Rosalind example #13

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

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

jakobnissen
Copy link
Member

Thanks for these tutorials! ❤️

It was probably an API mistake to allow converting between mutable, heap- allocated sequences. This is because convert is called implicit in Julia, and converting sequences:

  • Is slow compared to converting integers, causing unexpected allocations
  • Creates a new, mutable struct with a separate object identity. This can lead to nasty bugs when mutating the original sequence suddenly seems to have no effect, because the observed sequence is actually a distinct copy.

It was probably an API mistake to allow `convert`ing between mutable, heap-
allocated sequences. This is because `convert` is called implicit in Julia,
and converting sequences:
* Is slow compared to converting integers, causing unexpected allocations
* Creates a new, mutable struct with a separate object identity. This can lead
  to nasty bugs when mutating the original sequence suddenly seems to have
  no effect, because the observed sequence is actually a distinct copy.
@kescobo kescobo merged commit 28974b4 into BioJulia:main Mar 3, 2025
2 checks passed
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.

2 participants