You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for line = lines
headchar = line[1]
if headchar == "X"
break
end
...
end
... and then it never stops because it starts with 'X', not "X". It usually takes me a minute to realize why it's not working.
How feasible would it be to special-case a warning when checking a character and string for equality? Sort of similar to how
5 in Dict(5 => "yes", 3 => "no")
produces a special warning,
AbstractDict collections only contain Pairs;
Either look for e.g. A=>B instead, or use the `keys` or `values`
function if you are looking for a key or value respectively.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] in(p::Int64, a::Dict{Int64, String})
@ Base .\abstractdict.jl:28
I'm not familiar enough with the dispatch performance, but I could imagine that adding this check in the wrong place could impact performance heavily (by incurring a check+dispatch on every single instance of == anywhere). If the performance impact is minimal though, it might be handy.
The text was updated successfully, but these errors were encountered:
More than once I've made a mistake like,
... and then it never stops because it starts with 'X', not "X". It usually takes me a minute to realize why it's not working.
How feasible would it be to special-case a warning when checking a character and string for equality? Sort of similar to how
produces a special warning,
I'm not familiar enough with the dispatch performance, but I could imagine that adding this check in the wrong place could impact performance heavily (by incurring a check+dispatch on every single instance of
==
anywhere). If the performance impact is minimal though, it might be handy.The text was updated successfully, but these errors were encountered: