Skip to content
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

subsequence improvements #16

Open
7 tasks
cgay opened this issue Nov 22, 2024 · 0 comments
Open
7 tasks

subsequence improvements #16

cgay opened this issue Nov 22, 2024 · 0 comments

Comments

@cgay
Copy link
Member

cgay commented Nov 22, 2024

Andreas left a nice list of improvements needed for the subsequence code here, which I've included as a check-list below.

  • Start and end are insufficiently checked. It is quite easy to generate a subsequence of negative size by subsequence(foo, start: 5, end: 3).
  • Also, passing a negative start gives access to data outside the subsequence the user is allowed to see.
  • The semantics of omitting the sequence end isn't well-defined, especially given stretchy source sequences.
  • The good news: the above problems are not exploitable because everything is bounds-checked twice.
  • The bad news: the performance leaves to be desired because everything is bounds-checked twice.
  • Design decision: signal bounds error at subsequence creation time vs. element access time. The latter is more dynamic, the former gives better performance.
  • Feature wish: Read-only subsequences.
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

No branches or pull requests

1 participant