-
Notifications
You must be signed in to change notification settings - Fork 1
Add basic support for expressing algorithms in positionless form. #2
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
base: main
Are you sure you want to change the base?
Conversation
Created an iterator that maps to positionless operations. Currently we only support forward and backward access (no random access).
| "files.associations": { | ||
| "algorithm": "cpp" | ||
| "algorithm": "cpp", | ||
| "array": "cpp", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any files that end with .algorithm/.array etc. What are we using these file associations for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This list keeps changing while I'm working on the code. To be honest, I wish I didn't add this to git... but, on the other hand, I wouldn't spend any more time on this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure, I just wanted to make sure you didn't forget to commit something.
RishabhRD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments on contracts
| /// Marks the iterator at `iterator_index` as destroyed / not valid. | ||
| /// | ||
| /// - Precondition: iterator `iterator_index` is valid. | ||
| void destroy_iterator(size_t iterator_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want iterator_index to be 0 or 1. Otherwise, we need stronger contracts for copy_begin_iterator and copy_end_iterator to say begin and end iterators have not been destroyed previously. However, that contract seems to be too complicated to me.
| /// - Precondition: iterator `iterator_index` is valid. | ||
| size_t copy_iterator(size_t iterator_index); | ||
|
|
||
| /// Marks the iterator at `iterator_index` as destroyed / not valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking seems to be an implementation detail to me, somehow it feels like its about exposing the tombstone details outside. Maybe:
| /// Marks the iterator at `iterator_index` as destroyed / not valid. | |
| /// Removes iterator at `iterator_index` from algorithm data. |
|
One thing to notice here is, the complexity of algorithms in this case totally depends on assumption that |
Created an iterator that maps to positionless operations. Currently we only support forward and backward access (no random access).