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

add implicit named tuple and keyword argument names #34331

Merged
merged 2 commits into from
Mar 23, 2020

Conversation

JeffBezanson
Copy link
Sponsor Member

This implements #29333.

I went ahead and added dot syntax as well, i.e. a.b implies b=a.b.

@JeffBezanson JeffBezanson added compiler:lowering Syntax lowering (compiler front end, 2nd stage) keyword arguments f(x; keyword=arguments) labels Jan 9, 2020
@ararslan
Copy link
Member

ararslan commented Jan 9, 2020

Based on the doctest failure, it seems this inadvertently made unprovided required kwargs produce an UndefVarError instead of the expected UndefKeywordError.

@fredrikekre fredrikekre added the needs compat annotation Add !!! compat "Julia x.y" to the docstring label Jan 10, 2020
@tpapp
Copy link
Contributor

tpapp commented Jan 10, 2020

I think the dot syntax part, ie plot(x, y; options.width) being equivalent to plot(x, y; width=options.width), is a bit too much for now. I think would be better to just experiment with the feature as described in #29333 first.

@JeffBezanson
Copy link
Sponsor Member Author

I understand wanting to be cautious here, but I'm pretty sure languages tend to have either both of these features or neither. Also the a.b case should be less controversial, since b is already implicitly quoted, so there is no worry about e.g. renaming variables changing the meaning of a program.

@JeffBezanson JeffBezanson added the status:triage This should be discussed on a triage call label Mar 10, 2020
@JeffBezanson JeffBezanson removed the status:triage This should be discussed on a triage call label Mar 19, 2020
- `x` implies `x=x`
- `a.b` implies `b=a.b`

closes #29333
@JeffBezanson JeffBezanson added this to the 1.5 milestone Mar 19, 2020
@JeffBezanson JeffBezanson removed the needs compat annotation Add !!! compat "Julia x.y" to the docstring label Mar 19, 2020
@JeffBezanson JeffBezanson merged commit 8617860 into master Mar 23, 2020
@JeffBezanson JeffBezanson deleted the jb/implicitkwnames branch March 23, 2020 21:50
oxinabox pushed a commit to oxinabox/julia that referenced this pull request Apr 8, 2020
ravibitsgoa pushed a commit to ravibitsgoa/julia that referenced this pull request Apr 9, 2020
KristofferC pushed a commit that referenced this pull request Apr 11, 2020
- `x` implies `x=x`
- `a.b` implies `b=a.b`

closes #29333
jonas-schulze added a commit to mpimd-csc/ParaReal.jl that referenced this pull request Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) keyword arguments f(x; keyword=arguments)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants