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

Semicolon allowed on last expression in block? #545

Closed
Timmmm opened this issue May 16, 2024 · 1 comment
Closed

Semicolon allowed on last expression in block? #545

Timmmm opened this issue May 16, 2024 · 1 comment

Comments

@Timmmm
Copy link
Contributor

Timmmm commented May 16, 2024

I was a bit surprised that this compiles and works fine:

function test() -> bool = {
    true;
}

I would have thought it would complain about the semicolon and require

function test() -> bool = {
    true
}

Just checking if that is intentional?

@Alasdair
Copy link
Collaborator

Yes, this is intentional. I think the Rust-style trailing semicolon changing the meaning of a block to return unit is not a good fit for Sail, as we want to optimise a little bit more for readability.

@Timmmm Timmmm closed this as completed May 16, 2024
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

No branches or pull requests

2 participants