Open Jutho opened 5 years ago
The place this gets tricky is in combination with typed_vcat
syntax which also uses the semicolon. So we're toying with syntactic inconsistency if we have T[; x]
mean something completely different from T[y; x]
, which already means Expr(:typed_vcat, :T, :y, :x)
.
Having said that, we're not very consistent at the moment. We have:
julia> dump(:(x[y; a=1]))
Expr
head: Symbol typed_vcat
args: Array{Any}((3,))
1: Symbol x
2: Symbol y
3: Expr
head: Symbol =
args: Array{Any}((2,))
1: Symbol a
2: Int64 1
which parses but turns into a lowering error unless you translate it via a macro. And that's inconsistent with the following which parses to contain a :parameters
Expr...
julia> dump(:(x[y,z; a=1]))
Expr
head: Symbol ref
args: Array{Any}((4,))
1: Symbol x
2: Expr
head: Symbol parameters
args: Array{Any}((1,))
1: Expr
head: Symbol =
args: Array{Any}((2,))
1: Symbol a
2: Int64 1
3: Symbol y
4: Symbol z
For my use case, I don't quite care how it is parsed, just that it parses such that it is valid input within my macro context, and I can recognise the expression and transform it.
I noticed that the following does not parse:
For a regular function call, there is no problem
Arises in the context of experimenting with DSLs (with macros) for tensors