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

Allow merge x y z #467

Merged
merged 4 commits into from
Apr 10, 2019
Merged

Conversation

Nadrieril
Copy link
Member

Currently, parsing merge x y z is a parse error, and a surprising one
since the syntax resembles function application. This allows it.

Additionally, this clarifies that Some takes one argument and not
many, though without changing the grammar semantics surrounding it.

Currently, parsing `merge x y z` is a parse error, and a surprising one
since the syntax resembles function application. This allows it.

Additionally, this clarifies that `Some` takes one argument and not
many, though without changing the grammar semantics surrounding it.
@Gabriella439
Copy link
Contributor

Gabriella439 commented Apr 7, 2019

I would suggest fixing this in a different way, by adding merge and Some as additional cases to the application-expression rule since from a syntactic level they are conceptually behaving the same as function application. In other words, something like this, similar to how constructors worked before we removed it in #385:

application-expression =
      [ (merge / Some) whsp1 ] import-expression *(whsp1 import-expression)

There are two reason I suggest this:

  • I think its conceptually cleaner that any "function-application-like" (such as constructors/merge) goes under the application-expression rule
  • This formulation also prevents something like Some x Some y from being grammatically valid

@Nadrieril
Copy link
Member Author

Ah you're right, my PR allows f Some x but is parsed as f (Some x) which is unexpected

@Nadrieril
Copy link
Member Author

Fixed, but I still wanted to make explicit the number of arguments needed for Some/merge

standard/dhall.abnf Outdated Show resolved Hide resolved
@Nadrieril Nadrieril merged commit 3eeab6d into dhall-lang:master Apr 10, 2019
@Nadrieril Nadrieril deleted the something-something-merge branch May 2, 2019 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants