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 f(x, y=3) a syntax error #590

Closed
StefanKarpinski opened this issue Mar 15, 2012 · 3 comments
Closed

make f(x, y=3) a syntax error #590

StefanKarpinski opened this issue Mar 15, 2012 · 3 comments
Assignees
Labels
breaking This change will break code
Milestone

Comments

@StefanKarpinski
Copy link
Sponsor Member

This reserves the syntax for keyword arguments in the future (#485).

@ghost ghost assigned JeffBezanson Mar 15, 2012
@o-jasper
Copy link

a = :(f(x,=(y,3))).args[3]
b = :(f(x,y=3)).args[3] #This one will produce something else/a syntax error.
((a.head,a.args),(b.head,b.args)) #->((call,{=, y, 3}),(=,{y, 3}))

It isn't clear anymore how to make some arbitrary expression if the parser 'gets in your way'? Can be done though:

c = :(f(x,$Expr(:(=),{:y,3},Any))).args[3] #-> y = 3, that was what we wanted.

@JeffBezanson
Copy link
Sponsor Member

This isn't really a big deal, we're just reserving this syntax for keyword arguments in the future, so it should be an error now to ensure that code doesn't break.

@o-jasper
Copy link

In a sense maybe it was better off in eval(or the equivalent) or codegen.cpp somehow, so quote .. end and :(..) aren't affected, but too much goes on there already i guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code
Projects
None yet
Development

No branches or pull requests

3 participants