-
Notifications
You must be signed in to change notification settings - Fork 375
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
Remove lazy
option from the configuration option
#2931
Conversation
3eb2a14
to
569713b
Compare
Codecov Report
@@ Coverage Diff @@
## master #2931 +/- ##
========================================
Coverage 97.95% 97.95%
========================================
Files 1282 1282
Lines 70682 70438 -244
Branches 3250 3247 -3
========================================
- Hits 69236 68997 -239
+ Misses 1446 1441 -5
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
👋 @GustavoCaso, why is lazy being removed? |
569713b
to
22107ae
Compare
@marcotc I am preparing an RFC to reduce some of the complexity of our core configuration code and options. By any means, this is something we have to do, I instead want the guild to agree, but for the cases of the |
lazy
option from the configuration optionslazy
option from the configuration options
32988eb
to
f54d36f
Compare
lazy
option from the configuration optionslazy
option from the configuration option
f54d36f
to
cc61167
Compare
In my mind
So:
If we hold the above as true then it looks like |
cc61167
to
8deb36c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I really like this diff!
I think the missing bit is being a bit more clear on our advice to customers (do we want them to use experimental_default_proc
? And are they aware it may disappear soon?).
This is one situation where the warnings, as well as the PR description should be considered with advanced customers in mind as the readers, not only our team.
Datadog::Core.log_deprecation do | ||
'The `lazy` option is deprecated. You no longer need to specify an option to be lazy '\ | ||
"when the default value is a block.\n"\ | ||
'In the case edge case that you need the default value to be a block, please use the the expriemntal option:'\ | ||
'experimental_default_proc' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two notes on this:
- "You no longer need to" should perhaps be "you no longer can" -- this option is gone, it's not that you wouldn't ever need it
- Is it worth telling people to use the experimental option? Should we instead tell them that we don't support it all until we figure out what we should do?
b0a1cdb
to
5d914ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM. It may be worth to triple-check that everyone is happy with this internally, but I see no reason not to merge this in :)
5d914ad
to
88063eb
Compare
40af507
to
c926bc2
Compare
c926bc2
to
5b1c1f3
Compare
What does this PR do?
This PR removes the
lazy
option in favour of checking the content ofdefault.
These changes are part of an internal discussion of the ruby team 😄
Motivation
The
lazy
option is superfluous, the check to either evaluatedefault
as a block or a static value could be achieved by checking the type of valuedefault
is.default.is_a?(Proc)
There is an edge case:
The default value is a block.
When we provide a block to
default
and do not specify it aslazy
, we store the block as the default value. I added a new option,experimental_default_proc
, to circumvent that edge case. Pushing us to be more explicit about those edge cases makes the code more readable and easier to grok.Since this new option is experimental and we might not need it in the near future, I gave it a name that it clear to the reader that they should not rely on it and that is subject to change.
I added a deprecation warning to
lazy,
so if anyone is using the core code to build their settings, they can migrate to the new system.Additional Notes
How to test the change?
CI