Skip to content
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

Make :([x; y, z]) parseable #53530

Open
pablosanjose opened this issue Feb 29, 2024 · 0 comments
Open

Make :([x; y, z]) parseable #53530

pablosanjose opened this issue Feb 29, 2024 · 0 comments
Labels
parser Language parsing and surface syntax

Comments

@pablosanjose
Copy link
Contributor

pablosanjose commented Feb 29, 2024

To make DSLs one needs to use a syntax that is parseable, so that macros can ingest it
I'm trying to make a @mymacro distinguish between @mymacro((x; kw1=1, kw2=2) -> ...) and @mymacro([x; kw1=1, kw2=2] -> ...). I can make it work with @mymacro([x, y; kw1=1, kw2=2] -> ...) but not with a single positional argument.

The reason is that :([x; y, z]) is not parseable, but :([x, y; z, w]) and even:([x,; y, z]) are

julia> :([x; y, z])
ERROR: ParseError:
# Error @ REPL[1]:1:8
:([x; y, z])
#      ╙ ── unexpected comma in array expression
Stacktrace:
 [1] top-level scope
   @ none:1

julia> :([x,; y, z])
:([$(Expr(:parameters, :y, :z)), x])

After confirming on slack that this change would not be breaking, I'd like to propose to make :([x; y, z]) parseable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

2 participants