Why does scientific notation break the range function?

I must confess, Union{Nothing, Integer} is complete nonsense to me.

The entire error message, including the first line, is unnecessarily cryptic and overly complicated for such a simple issue. Even the first line of the message requires users to understand multiple Julia commands well enough to effectively compute code in their head.

Even as I now understand what the first line is trying to say, I cannot understand how Union{Nothing, Integer} is the same thing as saying Int. To figure this out, I find myself searching the docs for Nothing, and find this:

help?> Nothing
search: Nothing nothing isnothing

  Nothing

  A type with no fields that is the type of nothing.

  See also: isnothing, Some, Missing.

So tell me, what part of this error message is helpful to users who may innocently use 1e3 to represent the number 1000?

2 Likes