`where T` vs `where {T}`


When I read Julia source codes, sometimes the type parameterization writes where T, sometimes where {T}. Are they different or the same?


They are the same. where {T1, T2, T3} is the same as where T3 where T2 where T1 is the same as where {T3} where {T2} where {T1}.

Some people, me included, prefer to always put in the brackets even if unneeded, in order to aid the eye at scanning for type parameters. But that is a matter of taste. There probably is some piece of history here that I don’t know.


not much history beyond the “discovery” that writing
where {T1, T2, T3} leads to nicer visuals than where T3 where T2 where T1
there are occasions when the long form is helpful, where one or more of the Ti are compound or triangular locally