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

Calling methods without parameter names #133

Open
Clashsoft opened this issue Sep 3, 2019 · 1 comment
Open

Calling methods without parameter names #133

Clashsoft opened this issue Sep 3, 2019 · 1 comment
Assignees
Labels
feature New feature or request

Comments

@Clashsoft
Copy link
Member

Clashsoft commented Sep 3, 2019

Example:

Instead of the current:

There are pegs with name source and target.
We call moveDirect with source source and with target target.
We call moveDirect with source source and with target target.

We want to be able to write, for the second call:

We call moveDirect with source and target.
@Clashsoft Clashsoft added the feature New feature or request label Sep 3, 2019
@Clashsoft Clashsoft added this to the v0.8.1 milestone Sep 3, 2019
@Clashsoft Clashsoft self-assigned this Sep 3, 2019
@Clashsoft Clashsoft removed this from the v0.8.1 milestone Sep 4, 2019
@Clashsoft
Copy link
Member Author

I'm not sure I like the original idea now that I think about it. Omitting the parameter names and making it dependant on order removes quite some clarity. However, we could achieve almost the same by allowing argument labels to be inferred from the name of the value.

For example, in JavaScript and TypeScript we can do:

const foo = "foo"
const bar = "bar"
const obj = {
  foo,
  bar,
}
// equivalent to:
const obj = {
  foo: foo,
  foo: bar,
}

In the scenario language, the following would be equivalent:

We call moveDirect with source and with target.
We call moveDirect with source source and with target target.

This slightly deviates from the syntax in the original proposal in that it requires an additional with before target. That avoids confusion when lists are involved.

In a similar manner, we could do away with the awkward duplication in with clauses as part of There Sentences:

There is a University uni.
There is a Student with name Alice and with uni uni.
There is a Student with name Alice and with uni.

That should be a separate proposal, however.

@azuendorf, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant