About the `Array{<:Number, 2}` syntax


#1

Hi every julia linguist,

I am trying to find some info about the Array{<:Number, 2} syntax
for matrix, tensor as mentioned in the slide “about Julia 1.0” given by Stefan KARPINSKI / JuliaCon 2016


(goto 3m12s)

I do not find relevant track neither at http://github.com/JuliaLang/julia/issues or http://github.com/JuliaLang/Juleps
I have googled a lot of keywords combination without any success.

My last proposition may be dimensional parametric abstract type

Can someone tell me a bit more about it ?
Is there any page in the manual / github issue already dedicated to it ?


#2

That particular syntax is, I think: https://github.com/JuliaLang/julia/issues/6984

A lot of the other changes were implemented as part of: https://github.com/JuliaLang/julia/pull/18457
(e.g. you can now write the type Array{T,3} where T<:Number)


#3

Ok, thanks for your answer.

I gather here the links you mention and some others that could be useful.

FEATURE REQUEST: ADD SYNTACTIC SUGAR FOR COVARIANT ACTUAL TYPE PARAMETERS

SYNTACTIC SUGAR FOO{<:BAR} FOR FOO{T} WHERE T<:BAR #20414

TYPE SYSTEM REVISION AND NEW SUBTYPE ALGORITHM

TYPES / UNIONALL TYPES

METHODS / PARAMETRIC METHODS

I am still struggling a bit to find information about the parametric where rule

f(x::T) where T = T seems a bit tautological to me.


#4

where is a new syntax in the development version of Julia (0.6). More information will probably come once that releases.
I don’t think your ‘tautological’ example is right. It is short for f(x::T) where T <: Any = T, so it defines a function, for any T, that returns T (the type of x). If that is what you want it is not tautological.


#5

I agree that docs is rather sparse for now.

It seems to me that some default value could help a lot to enhance clarity.
Even the foo where bar where baz couldn’t be allegiated to foo where bar, baz

[edit] But the thread `Where` questions should be a better place to discuss about that :wink: