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

Tracking Issue for {char, u8}::is_ascii_octdigit #101288

Open
1 of 3 tasks
oppiliappan opened this issue Sep 1, 2022 · 11 comments
Open
1 of 3 tasks

Tracking Issue for {char, u8}::is_ascii_octdigit #101288

oppiliappan opened this issue Sep 1, 2022 · 11 comments
Assignees
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@oppiliappan
Copy link
Contributor

oppiliappan commented Sep 1, 2022

Feature gate: #![feature(is_ascii_octdigit)]

This is a tracking issue for two new methods char::is_ascii_octdigit and u8::is_ascii_octdigit, which, in the same vein as is_ascii_hexdigit, checks if a value is an ASCII octal digit ('0'..='7').

This is a shorthand for {char, u8}::is_digit(self, 8). Prior discussion on irlo.

Public API

// core::char

impl char {
    pub fn is_ascii_octdigit(self) -> bool;
}

// core::num

impl u8 {
    pub fn is_ascii_octdigit(self) -> bool;
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@oppiliappan oppiliappan added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Sep 1, 2022
@oppiliappan
Copy link
Contributor Author

@rustbot claim

@oppiliappan
Copy link
Contributor Author

This method is also applicable to bytes, so the scope of this issue extends to u8 as well.

@oppiliappan oppiliappan changed the title Tracking Issue for char::is_ascii_octdigit Tracking Issue for {char, u8}::is_ascii_octdigit Sep 2, 2022
@DaniPopes
Copy link
Contributor

DaniPopes commented Sep 28, 2023

This has been unstable for more than a year, and since there are no reported issues or blockers I think this can be stabilized.

The full API is this (note the &self and const):

impl {char,u8} {
    pub const fn is_ascii_octdigit(&self) -> bool;
}

@joshtriplett
Copy link
Member

Shall we stabilize is_ascii_octdigit?

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Oct 5, 2023

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 5, 2023
@workingjubilee
Copy link
Member

workingjubilee commented Oct 10, 2023

Every function we add comes at the cost of making it harder to find others, and u8 already has a very heavily-loaded API. I am concerned this doesn't pull its weight. Many new Rust programmers often flail for some time while looking for basic functions. In the past week I've had to coach people on locating basic things like str::find.

@BurntSushi
Copy link
Member

@rfcbot concern does not pull its weight

I'll file this concern because I'm not totally sold on this method either, but I lean towards including it. It fits right in with existing methods. With that said, octal notation is in my experience way less frequently used than either decimal or hexadecimal, so I'm not sold that it's worth adding a method specifically for it.

We have at least a few examples where we load up types with lots of different methods, so I tend to think we should try to approach that problem in other ways. For example, improving rustdoc output. I am a casual user of separating methods into different groups based on categories that I think might be useful to others. Of course, one of the issues with this approach is that grouping is also somewhat determined by trait bounds, so this could overall be somewhat confusing given the status quo of rustdoc.

@m-ou-se
Copy link
Member

m-ou-se commented Nov 7, 2023

I'm also not convinced this method is worth adding. (Would we also add is_ascii_bindigit() too?)

On char, this funcitonality is already available as .is_digit(8) (and .to_digit(8).is_some()).

@dtolnay
Copy link
Member

dtolnay commented Jan 1, 2024

+1 to the feeling that is_ascii_octdigit does not pull its weight as a dedicated API on u8 and char.

For char this is served plenty well enough by .is_digit(8) as Mara wrote.

What's the counterproposal for u8? Is it this?—

let byte = b'7';
println!("{}", (byte as char).is_digit(8));

@dtolnay
Copy link
Member

dtolnay commented Jan 16, 2024

From the last couple comments, I get the sense this is not going to go through.

@rfcbot fcp cancel

@rfcbot
Copy link

rfcbot commented Jan 16, 2024

@dtolnay proposal cancelled.

@rfcbot rfcbot removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants