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

Conditional expression must be either alone or inside parenthesis #11

Open
Shachar opened this issue Dec 28, 2019 · 0 comments
Open

Conditional expression must be either alone or inside parenthesis #11

Shachar opened this issue Dec 28, 2019 · 0 comments
Labels
language design Need to make a desion about the design of the language

Comments

@Shachar
Copy link
Collaborator

Shachar commented Dec 28, 2019

As currently implemented, conditional expressions must either come alone (i.e. - not interact with any other operator), or surrounded by parenthesis. So, this is legal:

def chain( number : U64 ) -> U64 {
  if( numer%2 == 0 ) {
    number/2
  } else {
    number*3 + 1
  }
}

And this is also legal:

def chain( number: U64 ) -> U64 {
  ( if(number>12) {number} else {12} ) + 5
}

But this isn't:

def chain( number: U64 ) -> U64 {
  if(number>12) {number} else {12} + 5
}

Currently, this is a limitation of the parser, but we need a debate on whether that's actually a good restriction on conditional expressions.

@Shachar Shachar added the language design Need to make a desion about the design of the language label Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language design Need to make a desion about the design of the language
Projects
None yet
Development

No branches or pull requests

1 participant