Skip to content

Conversation

@AStepanov25
Copy link
Contributor

No description provided.

@AStepanov25 AStepanov25 requested a review from a team as a code owner October 19, 2025 14:30
rvanasa
rvanasa previously approved these changes Oct 24, 2025
Copy link
Collaborator

@rvanasa rvanasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-actions github-actions bot dismissed rvanasa’s stale review November 5, 2025 13:18

Review dismissed by automation script.

@timohanke
Copy link
Contributor

Is the trapping behaviour when out of bound desired?

It could be more convenient for the code using this if truncating out of bound would do nothing. I mean in the same sense as a half-open interval [0,-1) is in some languages silently accepted as an empty interval and doesn't trap.

Any opinions?

@AStepanov25
Copy link
Contributor Author

We can generalize truncate and addRepeat to resize.

@rvanasa
Copy link
Collaborator

rvanasa commented Nov 10, 2025

It could be more convenient for the code using this if truncating out of bound would do nothing. I mean in the same sense as a half-open interval [0,-1) is in some languages silently accepted as an empty interval and doesn't trap.

I don't have a strong opinion either way about this but am slightly leaning towards no-op instead of trapping.

@timohanke
Copy link
Contributor

am slightly leaning towards no-op instead of trapping.

Same. I think it makes surrounding code easier because it saves some if statements in the surrounding code.

We can generalize truncate and addRepeat to resize.

We could, but truncate alone is still easier to use. If you wanted to truncate with resize then wouldn't you have to supply a default value for the addRepeat inside it, even though you know it's not going to be used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants