-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Lonely Operator vs Null Object Pattern vs try! chains vs present? chains #381
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
Comments
We've talked about this before internally, and I don't think many of us are fans of this, as it encourages the use of So I think it's one of those things that would be used sparingly, if absolutely necessary. |
So maybe a line in the guides suggesting a NullObject Pattern instead? |
That's what I would do. "Prefer the Null Object pattern over using |
It feels too early to write up a guideline on how to use this. Plenty of us have existing thoughts on |
I'm going to close this. We can revisit the topic with a pull request when we have more usage of this operator. (Also, I can't think of a guideline for this that fits our guides; our guides are things we agree on, but not a list of decision trees on when to use language features.) |
Ruby 2.3.0 introduced the Lonely Operator:
https://bugs.ruby-lang.org/issues/11537
The text was updated successfully, but these errors were encountered: