I have experienced that Julia is not very generous with automatic typecasting (or type conversion).
e.g.
f(x::Int) = x
f(1.0)
ERROR: MethodError: no method matching f(::Float64)
Closest candidates are:
f(::Int64) at REPL[4]:1
Stacktrace:
[1] top-level scope
@ REPL[5]:1
Although I understand that this is a design choice, sometimes it can be a pain.
For example using the Makie package I discovered that the following yields an error
using GLMakie
a = Vector{Any}([1,2,3,4,5])
barplot(a)
ERROR: `Makie.convert_arguments` for the plot type Combined{Makie.barplot, Tuple{Vector{Any}}} and its conversion trait PointBased() was unsuccessful.
The signature that could not be converted was:
::Vector{Any}
Makie needs to convert all plot input arguments to types that can be consumed by the backends (typically Arrays with Float32 elements).
You can define a method for `Makie.convert_arguments` (a type recipe) for these types or their supertypes to make this set of arguments convertible (See http://makie.juliaplots.org/stable/documentation/recipes/index.html).
Alternatively, you can define `Makie.convert_single_argument` for single arguments which have types that are unknown to Makie but which can be converted to known types and fed back to the conversion pipeline.
...
I understand that the first one is a design choice of the language, with consistency being one of the advantages.
But in the second case, the package usability could probably be increased if such conversions could be automatically handled. I would guess for example that implementing a Any => Float64 conversion would deal with the majority of the error cases in the Makie package.