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

Use Bullet Notation For 'pub' Keyword #1250

Closed
human154 opened this issue Aug 17, 2021 Discussed in #1249 · 3 comments
Closed

Use Bullet Notation For 'pub' Keyword #1250

human154 opened this issue Aug 17, 2021 Discussed in #1249 · 3 comments

Comments

@human154
Copy link

human154 commented Aug 17, 2021

Discussed in #1249

Originally posted by human154 August 17, 2021
The suggestion is to replace this syntax (with the pub keyword):

pub fn someFunc(x, y) {
todo
}

pub type SomeType {
todo
}

with this (using a leading dash instead):

-fn someFunc(x, y) {  
todo
}

-type SomeType {     
todo
}
  • The obvious disadvantage of this is that the dash is less intuitively meaningful, however, it is easy to learn and we only need to learn it once.

  • Once it's meaning is understood, the dash syntax would be less noisy and easier to read. The 'pub' keyword is important but shouldn't be the central focus and currently it takes up slightly more mindshare than it deserves.

  • This would make it faster for humans and the compiler to parse the code and also easier to write and later modify.

@lpil
Copy link
Member

lpil commented Aug 17, 2021

Hello! Thanks for the suggestion.

Gleam tries to avoid operators in favour of words because newcomers cannot google operator names, so this change will not be accepted I'm afraid. I also have concerns that this - would be unfamiliar to most and as such off-putting. We've tried to make the syntax as generally appoachable as possible (which is why we no longer have Haskell like syntax).

@human154
Copy link
Author

Ok, I wanted it but didn't expect it. :)
Your points are valid. I was willing to sacrifice other people's happiness for my own. :)
I thought I would give it a shot anyway.
I appreciate all your work and your responding so quickly!
I will close the issue.

@lpil
Copy link
Member

lpil commented Aug 17, 2021

Thank you, always good to get more opinions and insights

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