While I prefer the new syntax, I must admit, I still have a mental hiccup when reading the “where” term. I always translate it to something like “for_a_certain”, “with_type”, or “for_all”.
Where I have questions though are the curly brackets. It seems confusing, sometimes there is a where {T}
but sometimes a pure where T
.
Tendencially in one-liner functions {T}
is being used and in full (multiline) functions T
. But ack "where {T" base/
and ack "where T" base/
show that this is not (yet?) the case everywhere, e.g.
HistoryPrompt(hp::T) where T<:HistoryProvider = HistoryPrompt{T}(hp)
function TwicePrecision{T}(nd::Tuple{I,I}) where {T,I}
n, d = nd
TwicePrecision{T}(n, zero(T)) / d
end
Maybe I made this up and there isn’t such a convention, not sure. It was discussed in the above-mentioned 20308 issue. Personally I’d have preferred a pure T
without brackets (and get used to the slightly/much confusing where T = xy
consequence).