Constant "type parameter" and inner constructor error message

question

#1

The following is an MWE from a typo that I made during refactoring some code:

struct Foo{Float64}
    x::Int
    Foo() = new(1)
end

that gave the curious error message

WARNING: deprecated syntax "inner constructor Foo(...) around /tmp/e.jl:3".
Use "Foo{Float64}(...) where Float64" instead.

Am I right in thinking that in

struct Foo{Float64}
    x::Int
    Foo{Float64}() where Float64 = new(1)
end

the Float64 is a type parameter, eg fully replaceable with T or something without changing the semantics?


#2

Yes, this is equivalent to:

struct Foo{T}
    x::Int
    Foo{T}() where T = new(1)
end

#3

I wonder if this (type parameter name coinciding with type name) would deserve at least a warning, or I was just staring at it for 5 minutes because this has been a long day :smile: