Skip to content

Change type of end field in slices to Bound - #480

Closed
jturner314 wants to merge 1 commit into
rust-ndarray:masterfrom
jturner314:slice-end-bound
Closed

jturner314 wants to merge 1 commit into
rust-ndarray:masterfrom
jturner314:slice-end-bound

Conversation

@jturner314

Copy link
Copy Markdown
Member

I just noticed the Bound enum in the standard library while I was reading about the new RangeBounds trait. I thought I'd propose switching to the Bound type, now that we have support for inclusive ranges (#467). There is no memory cost to doing this (since Bound<isize> and Option<isize> are the same size). This is a breaking change.

I'm pretty ambivalent about this PR, since Option has the benefit of being more common than Bound and having lots of convenient methods. It's also nice to only have to deal with exclusive end bounds after the Slice/SliceOrIndex is created. So, I'm curious to see what everyone thinks about this change.

Change type of `Slice.end` and `SliceOrIndex::Slice.end` from
`Option<isize>` to `Bound<isize>`.
@jturner314 jturner314 mentioned this pull request Aug 28, 2018
@bluss

bluss commented Aug 28, 2018

Copy link
Copy Markdown
Member

Pretty ambivalent / I'd decline the complication since we should do this to get the upsides, not just because we can. So with a plan, it could be good.

@jturner314

Copy link
Copy Markdown
Member Author

Okay, I'll close this. I don't see any significant upsides, so we might as well avoid unnecessary breakage. If we find a specific use-case in the future, we can always make this change then.

@jturner314 jturner314 closed this Aug 28, 2018
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.

2 participants