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

Subscript exceptionless signatures #23

Open
ratmice opened this issue Mar 16, 2018 · 1 comment
Open

Subscript exceptionless signatures #23

ratmice opened this issue Mar 16, 2018 · 1 comment

Comments

@ratmice
Copy link

ratmice commented Mar 16, 2018

I was curious if anyone had considered implementing signatures like VECTOR, and VECTOR_SLICE,
in terms of an opaquely ascribed cursor/iterator type, which ensures the the constraint that 0 <= i <= i + n <= |v|, where |v| is the length of v.

Then implementing the existing VECTOR/VECTOR_SLICE internally as functions from (int, cursor) -> cursor which raise Subscript exceptions when constructing the cursor to be returned, or having the cursor type transparently ascribed.

Or too much hassle for too little gain, because e.g. the lack of dependent types means 2 vectors of the same length would have to be represented by different cursor types? Mainly wanted to gauge reaction before thinking too hard about the details of implementing e.g. vector in terms of this.

@JohnReppy
Copy link
Contributor

If I remember correctly (it was 20 years ago), we considered an iterator interface to the sequence combinators with ways to construct iterators for the sequence types. We decided not to follow this design path for two reasons: it was a big departure from the previous design and existing implementations would have had trouble implementing it efficiently, since it would require aggressive cross-module inlining and fusion.

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

2 participants