-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: do
with infix calls
#414
Comments
You can do @forall(x in y) do a, b
# ...
end |
Note that, in a bizarre twist of syntax, this form of I think that's good enough for this use case? Demo: julia> macro forall(exs...)
dump(exs)
nothing
end
@forall (macro with 6 methods)
julia> @forall(x in y) do a
end
Tuple{Expr, Expr}
1: Expr
head: Symbol ->
args: Array{Any}((2,))
1: Expr
head: Symbol tuple
args: Array{Any}((1,))
1: Symbol a
2: Expr
head: Symbol block
args: Array{Any}((1,))
1: LineNumberNode
line: Int64 1
file: Symbol REPL[15]
2: Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol in
2: Symbol x
3: Symbol y See also the julia> parsestmt(SyntaxNode, """
@forall(x in y) do a
end
""")
line:col│ tree │ file_name
1:1 │[macrocall-p]
1:2 │ @forall
1:9 │ [call-i]
1:9 │ x
1:11 │ in
1:14 │ y
1:16 │ [do]
1:19 │ [tuple]
1:20 │ a
1:21 │ [block] |
yeah, my hope was to try and do it without the parens, but oh well. |
I was disapointed today to learn that I can't write the following macro:
because
(x in y) do
is a syntax error, one can only writein(x, y) do
. Is this something reasonable to allow?The text was updated successfully, but these errors were encountered: