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

added rule 3.1.16 #5

Merged
merged 1 commit into from
Aug 31, 2016
Merged

added rule 3.1.16 #5

merged 1 commit into from
Aug 31, 2016

Conversation

cezarywojcik
Copy link
Member

See diff for new rule.

I ran tests to confirm that using an enum as a static function container is actually faster + produces a smaller binary than using a class. A struct is actually just slightly better in this regard, but the difference is very small, and the added benefit of not being able to instantiate the container is arguably worth it.

@@ -473,6 +473,8 @@ do {

* **3.1.15** If you have a function that takes no arguments, has no side effects, and returns some object or value, prefer using a computed property instead.

* **3.1.16** For the purpose of namespacing a set of `static` functions and/or computed properties, prefer using a caseless `enum` over a `class` or a `struct`. This way, you don't have to add a `private init() { }` to the container.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe repeat the word static again. It seems not quite clear whether static refers to "functions" only or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@drumnkyle drumnkyle merged commit bdd40b9 into linkedin:master Aug 31, 2016
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

Successfully merging this pull request may close these issues.

2 participants