-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add .toXOption
methods from StringOps
#554
Comments
The usual style in Scala is to assume that things aren't null. So I doubt that many people are avoiding (I feel like there was a pretty thorough discussion in scala/bug about nulls and extension methods, but I can't seem to find it...) In any case, I do think that |
Because I find many people like using |
@rjolly and I are looking at this at the Open Source Spree in Paris. We're starting with just One question here is where the new code should live. |
I think the steps to a solution here are:
|
Note that I've narrowed the scope of the ticket to just the |
@jxnu-liguobin about |
My own justification there is very thin: It chooses to throw consistently throw a NPE over a NumberFormatException, with an at-least-better-than-its-now justification. The probably almost zero cost of the null check (the benchmarks in the original MR could be used to verify that assumption of near zero cost) means to me that added convenience can be pretty small to be worth it too. In this specific case, because these things are explicitly for validation, I can get behind the idea of doing the null check, even if it doesn't occur in idiomatic scala. The whole point is to do quick validation, and I thought it was only called an Open Source Spree if it was held around the Spree region in Berlin, and that in Paris it's just a sparkling source Seine. |
Fixes scala#554
Fixes scala#554
Fixes scala#554
Fixes scala#554
Fixes scala#554
Fixes scala#554
Fixes scala#554
Fixes scala#554
There are some useful method in scala2.13.x, such as toLongOption, But it throws an NPE when the string is null, so probably not many people use it?
The text was updated successfully, but these errors were encountered: