Skip to content

Conversation

@lucteo
Copy link
Collaborator

@lucteo lucteo commented Dec 4, 2025

Created an iterator that maps to positionless operations. Currently we only support forward and backward access (no random access).

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",
Copy link
Member

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?

Copy link
Collaborator Author

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 :)

Copy link
Member

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.

Copy link
Member

@RishabhRD RishabhRD left a 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);
Copy link
Member

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.
Copy link
Member

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:

Suggested change
/// Marks the iterator at `iterator_index` as destroyed / not valid.
/// Removes iterator at `iterator_index` from algorithm data.

@RishabhRD
Copy link
Member

One thing to notice here is, the complexity of algorithms in this case totally depends on assumption that algorithm_data would contain potentially bounded and small number of iterators information.
The good thing is that's usually the case atleast the algorithms I remember follows the same. However, it might be interesting if we can find any counter-example to that. I really feel if they exist, those algorithms should be really rare.

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.

4 participants