Skip to content

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