-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Doc some string parsing macros #28085
Conversation
base/int.jl
Outdated
julia> @int128_str "123456789123" | ||
123456789123 | ||
|
||
julia> @int128_str "123456789123.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the int128"1234"
syntax here and in the other examples since that is how they are used in 99% of the cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is worth showing the @int128_str "123"
form, since the _str
suffix is kind of an implementation detail, and it is never used that way.
base/int.jl
Outdated
|
||
# Examples | ||
```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*" | ||
julia> @int128_str "123456789123" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this form even worth showing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with the other ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth showing just because the doc string has that format. It's not very long...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree; the _str
is an ugly implementation detail that is not necessary to show. It is IMO better to say that this is a string macro, and reference that section in the manual, where interested users can read more about the implementation.
because the doc string has that format
I think we can change it to
"""
int128"str"
Parse `str` as ...
"""
which looks better, and is how you would encounter in IRL.
base/int.jl
Outdated
julia> @int128_str "123456789123.4" | ||
ERROR: LoadError: ArgumentError: invalid base 10 digit '.' in "123456789123.4" | ||
Stacktrace: | ||
[1] tryparse_internal(::Type{Int128}, ::String, ::Int64, ::Int64, ::Int64, ::Bool) at ./parse.jl:118 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this stackframe?
Worth mentioning that these are emitted by the parser for long numeric literals. |
@kshyatt any plans to rebase and update this? Would be really nice :-) |
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
After my silly self deleted the old branch...