-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
RFC: Deprecate Int-Char comparisons, e.g. 'x' == 120 #16024
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,9 @@ function parseinline(stream::IO, md::MD, config::Config) | |
content = [] | ||
buffer = IOBuffer() | ||
while !eof(stream) | ||
char = peek(stream) | ||
# FIXME: this is broken if we're looking for non-ASCII | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woudn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need read(io, UInt8)
read(io, Char)
peek(io, UInt8)
peek(io, Char) with the defaults matching. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, |
||
# characters because peek only returns a single byte. | ||
char = Char(peek(stream)) | ||
if haskey(config.inner, char) && | ||
(inner = parseinline(stream, md, config.inner[char])) !== nothing | ||
c = takebuf_string(buffer) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,3 +244,5 @@ let s = Set(1:5) | |
end | ||
|
||
@test pop!(Set(1:2), 2, nothing) == 2 | ||
|
||
@test length(Set(['x',120])) == 2 |
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.
Wouldn't it be better to leave
next
as a byte here and compare withUInt8('\n')
?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.
Performance-wise, both solutions seem to give the same native code. I just tried with:
But as regards style, I prefer converting to
Char
.