Closed jtrakk closed 3 years ago
In the early days we use where
, however the precedences of expressions get wrong.
For instance, if you use a range pattern 1:2
, but you get a 1: (2 where a)
.
julia> dump(:(1:2 where a ))
Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol :
2: Int64 1
3: Expr
head: Symbol where
args: Array{Any}((2,))
1: Int64 2
2: Symbol a
I guess that's the same problem as https://github.com/JuliaLang/julia/issues/21847
Is a:b where p
the main case we're worried about? x where x < 2 => 2
seems like a pretty common case and afaict doesn't have that problem.
Currently we can use
where
for types, as in advanced type patterns. We also haveif/end
andGuardBy
.Can we also use
where
for value predicates like OCaml'swhen
clause?