Hi all,
using julia 1.6.1 there is currently an inconsistency when using bits (i.e. anything which is a bit-type) as type-parameters and when comparing bits directly with types.
julia> f(::Type{Tuple{T1}}) where T1 <: Any = :hi
f (generic function with 1 method)
julia> f(Tuple{1})
:hi
julia> 1 <: Any
ERROR: TypeError: in <:, expected Type, got a value of type Int64
Stacktrace:
[1] top-level scope
@ REPL[3]:1
The one or the other does not make sense, either 1 <: Any or not. It should not make a difference whether it is a type-parameter or not.
Or should it?
I can see why this feels inconsistent. From the practical point of view, isbits in type parameter enables nice things such as Matrix = Array{T, 2}, and that a distinguished syntax is annoying to remember?
thanks for your remark. Yes, I also use this quite a lot and a recent package, in my case it simplifies the syntax nicely.
Do you know whether there is an github issue which discussed this?
If it was done intentionally, I bet there was more discussion around it.
My current workaround is to just add another helper function to dispatch the parameter types normally, where everything works nicely again. So not a blocking point for so far luckily, but still it would be nice to address this inconsistency. At least with some documentaion added to the official julia docs.