julia icon indicating copy to clipboard operation
julia copied to clipboard

More information on the parse function.

Open udohjeremiah opened this issue 2 years ago • 1 comments

Providing more information on how the parse function works with floating point literals would be great, as I've ran into situations where I thought it intuitive to work with the Float32 numeric literal, but it throws an error.

Providing a !!! note up-front about this behaviour and how to go around it would be great to inform users to take notice of such occurrences.

udohjeremiah avatar Aug 22 '22 11:08 udohjeremiah

I've had a rethink on this and it doesn't seems "elegant" to provide a !!! note on a case where there's just one exception.

So its best to include the exception on # Example and then show how to bypass it - in the example as well.

This seems concise and elegant and would even give users "an hint" to try out other numeric literals and see if they work as well - which they all do (to my best knowledge). And even if they don't, that can lead to a potential useful PR or even an ISSUE.

udohjeremiah avatar Sep 21 '22 08:09 udohjeremiah

@KristofferC is still being looked into?

udohjeremiah avatar Sep 21 '22 19:09 udohjeremiah

We could add more details of the type of formats we accept in parse. For example:

julia> parse(Float64, "0x2.3ep5")
71.75

julia> parse(Int, "0o777")
511

but just adding a case of Julia syntax that doesn't parse doesn't seem worthwhile.

KristofferC avatar Nov 03 '22 12:11 KristofferC