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

Separators of operations are parsed inconsistently #595

Open
jiribenes opened this issue Sep 17, 2024 · 2 comments
Open

Separators of operations are parsed inconsistently #595

jiribenes opened this issue Sep 17, 2024 · 2 comments

Comments

@jiribenes
Copy link
Contributor

jiribenes commented Sep 17, 2024

The following program using a space to separate two operations (both in their definition and implementation) is currently syntactically valid:

interface Foo { def foo(): Int def bar(): Int }
def main() = 
  try { do foo() + do bar() }
  with Foo { def foo() = resume(42) def bar() = resume(100) }
Proof Screenshot 2024-09-17 at 17 38 42

Inserting semicolons in order to separate the two operations is not allowed: neither in their definition, nor in their implementation.


In contrast, if you write:

type Quux { Bar() Baz() }

then you actually must insert a semicolon or a newline to get a successful parse.

@jiribenes
Copy link
Contributor Author

jiribenes commented Sep 17, 2024

Related to #287, as the following suggestion would make it a little bit more symmetric:

sequence constructors not with semicolons type B { True(); False() } but type B { case True() case False() }

@jiribenes
Copy link
Contributor Author

Maybe one more reason why it feels surprising:

def helloWorld() = {
  def foo() = println("hello") def bar() = println("goodbye")
  foo(); bar()
}

does not parse here (requires a newline between the two definitions), but parses fine in the cases outlined above.

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

No branches or pull requests

1 participant