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

Is this supposed to work? #474

Closed
dabrahams opened this issue Apr 19, 2021 · 6 comments
Closed

Is this supposed to work? #474

dabrahams opened this issue Apr 19, 2021 · 6 comments
Assignees
Labels
explorer Action items related to Carbon explorer code inactive Issues and PRs which have been inactive for at least 90 days.

Comments

@dabrahams
Copy link

fn f(Int: x, Int: y) -> Int { return x; }
fn main() -> Int { return f(.y = 3, .x = 0); }

I get a "missing field y" compilation error.

@dabrahams dabrahams added the explorer Action items related to Carbon explorer code label Apr 19, 2021
@josh11b
Copy link
Contributor

josh11b commented Apr 20, 2021

In the proposal I wrote (not accepted), that was not legal since the definition of f did not specify any named parameters. If you changed it to:

fn f(.x = Int: x, .y = Int: y) -> Int { return x; }
fn main() -> Int { return f(.y = 3, .x = 0); }

Then I would expect to get an error that the arguments are passed in a different order than the parameters. That is something I would like to relax, but there are concerns about defining the order of evaluation and destruction when there are two possible orders to choose from.

@dabrahams
Copy link
Author

Ah, thanks, that one does in fact work. Although, it does not report an error.

@tkoeppe
Copy link
Contributor

tkoeppe commented Apr 21, 2021

(Could you kindly edit the issue titile to be somewhat meaningful when read on its own, e.g. in the issues summary list?)

@jsiek
Copy link
Contributor

jsiek commented Apr 21, 2021

I've opened issue #481 to update the executable semantics to implement the ordering restriction Josh mentioned above.

@github-actions
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the inactive label. The long term label can also be added for issues which are expected to take time.
This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Issues and PRs which have been inactive for at least 90 days. label Jul 28, 2021
@zygoloid
Copy link
Contributor

The executable semantics side of this was addressed in #481. There's also a specification question here, which is covered by #505 and in particular its question "Are named parameters positional?".

Closing this in favor of those two other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explorer Action items related to Carbon explorer code inactive Issues and PRs which have been inactive for at least 90 days.
Projects
None yet
Development

No branches or pull requests

5 participants