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

CS2 Discussion: Features: Static keyword #4963

Closed
coffeescriptbot opened this issue Feb 19, 2018 · 3 comments
Closed

CS2 Discussion: Features: Static keyword #4963

coffeescriptbot opened this issue Feb 19, 2018 · 3 comments

Comments

@coffeescriptbot
Copy link
Collaborator

coffeescriptbot commented Feb 19, 2018

From @GeoffreyBooth on 2017-01-27 06:32

CoffeeScript classes already have support for static methods, via @methodName syntax:

class Maths
  @square: (x) -> x * x

Assuming we implement getters and setters, and assuming their syntax looks something like this:

class Square extends Rectangle
  get perimeter: -> @side * 4
  set area: (x) -> @side = Math.sqrt x

Then I think we should also support the static keyword, for consistency:

class Maths
  static square: (x) -> x * x

Please keep discussion of get and set over in coffeescript6/discuss#17. If we decide not to implement get and set, or if we implement them in some syntax unlike what’s here, then we don’t need the static keyword. I propose we add the static keyword only if we add get and set keywords. We would also keep the @methodName syntax, for backward compatibility.

@coffeescriptbot
Copy link
Collaborator Author

From @mrmowgli on 2017-03-17 07:22

I actually would like to avoid adding an alternate keyword for this. I think current way of dealing with it is consistent with the language. I can see some confusion around this, but for the most part that falls back to adding to the documentation.

@coffeescriptbot
Copy link
Collaborator Author

From @mrmowgli on 2017-03-17 07:22

Also it looks like we are avoiding adding get/set to the language.

@coffeescriptbot
Copy link
Collaborator Author

coffeescriptbot commented Feb 19, 2018

From @GeoffreyBooth on 2017-04-10 00:17

Closing per consensus in coffeescript6/discuss#17

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

1 participant