Skip to content

Support is_letter() on char #38125

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

Closed
wants to merge 1 commit into from
Closed

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Dec 2, 2016

Fix #37069.

@rust-highfive
Copy link
Contributor

r? @nrc

(rust_highfive has picked a reviewer for you, use r? to override)

/// assert!(!c.is_letter());
/// assert!(!'5'.is_letter());
/// ```
#[stable(feature = "rust1", since = "1.15.0")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure about this annotation.

Copy link
Member

@nagisa nagisa Dec 2, 2016

Choose a reason for hiding this comment

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

  1. First of all new additions are almost never instantly stable. You want the unstable.
  2. You cannot use rust1 feature name. Rather you need a name unique for this feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. Marked unstable and gave it its own name. There's no tracking issue for marking this stable, so set it to "0", as I saw with other features.

@nrc
Copy link
Member

nrc commented Dec 2, 2016

r? @aturon (this is libs stuff, but I've no idea who should review)

@rust-highfive rust-highfive assigned aturon and unassigned nrc Dec 2, 2016
@estebank estebank force-pushed the is_letter branch 2 times, most recently from f3a4c4e to 543b031 Compare December 2, 2016 20:16
@alexcrichton
Copy link
Member

Thanks! Like some of the other unicode properties could the documentation also define what it means to be a letter? (basically just say what class it's in)

Also, if you want to open an issue for this, feel free to just cc me and I'll tag it (and then you can update the reference here)

/// A `char` is alphabetic if it belongs to any of [the following
/// categories](http://unicode.org/reports/tr44/#Alphabetic):
///
/// Lu | Ll | Lt | Lm | Lo | Nl | Other_Alphabetic
Copy link
Member

Choose a reason for hiding this comment

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

As per the errors in Travis CI, rustdoc will treat this indented section as code that should be tested. You could do something like this though:

```ignore
Lu | Ll | Lt | Lm | Lo | Nl | Other_Alphabetic
```

https://doc.rust-lang.org/book/documentation.html#running-documentation-tests

Copy link
Member

Choose a reason for hiding this comment

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

Good call with your latest commit. ignore probably still does Rust syntax highlighting.

@estebank estebank force-pushed the is_letter branch 2 times, most recently from 7d3e8c4 to 6541928 Compare December 3, 2016 23:52
@bors
Copy link
Collaborator

bors commented Dec 12, 2016

☔ The latest upstream changes (presumably #38049) made this pull request unmergeable. Please resolve the merge conflicts.

@SimonSapin
Copy link
Contributor

Why does this need to be in the standard library rather than in an external crate? This PR adds 4336 bytes of static data, and I don’t know if linkers are Sufficiently Advanced to remove this data from programs that don’t use it.

In my opinion the fact that std already has other methods that require similarly large tables is not a sufficient reason to add more of them.

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jan 19, 2017
@alexcrichton
Copy link
Member

@SimonSapin I would consider "commonly used properties" to be candidates for being in std, but we shouldn't be exhausted by any means.

This extra data should always be eliminated if not used, however. Due to our usage of --gc-section (or the equivalent) all unused pieces of the standard library are stripped from executables.

@SimonSapin this is still unstable, though, but do you still think this should start externally first?

@SimonSapin
Copy link
Contributor

I would consider "commonly used properties" to be candidates for being in std

Alright. My point is that, in the past, the bar for inclusion has been higher than having one person say "I think it makes sense to have this in std" and sending a PR.

@alexcrichton
Copy link
Member

@SimonSapin sure yeah I agree, but other standard library having such properties is a good indication as well.

@estebank
Copy link
Contributor Author

estebank commented Jan 23, 2017

Should I close this PR then? (Given that #38137 was closed.)

@alexcrichton
Copy link
Member

Discussed during libs triage today and our conclusion was that is_alphabetic is close enough for now for "useful" and we'd prefer to hold off on adding a new category until there's perhaps more widespread motivation. As a result, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants