Closed jaminthorns closed 3 weeks ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.65%. Comparing base (
ab86164
) to head (096dbf3
). Report is 3 commits behind head on main.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
I think it needs a new name entirely then as this feels confusing. I don't have a constructive opinion on what it should be. drop
could still be kept and the type signature updated. That's probably the simplest route.
Changing the type names can be a backwards incompatible change. So the easiest is to make it so @type drop :: keep
.
@josevalim Didn't realize that about backwards incompatibility, thank you!
@bryannaegele Do you think it would be confusing to implement @josevalim's suggestion (drop
being an alias of keep
)? I can instead just duplicate the the types like they were before:
@type keep ::
(:telemetry.event_metadata() -> boolean())
| (:telemetry.event_metadata(), :telemetry.event_measurements() -> boolean())
@type drop ::
(:telemetry.event_metadata() -> boolean())
| (:telemetry.event_metadata(), :telemetry.event_measurements() -> boolean())
But I consolidated them to prevent a mistake like the one I made, especially now that they're more complex. I have no issue with this if it's more readable, though.
I think aliasing to keep would be confusing. Copying is the simplest. If I were forced to refactor it, I'd alias the values.
Something like
@type metadata_predicate_fun() :: (:telemetry.event_metadata() -> boolean())
@type metadata_measurement_predicate_fun() :: (:telemetry.event_metadata(), :telemetry.event_measurements() -> boolean())
@type keep :: metadata_predicate_fun() | metadata_measurement_predicate_fun()
@type drop :: metadata_predicate_fun() | metadata_measurement_predicate_fun()
@type drop :: keep
is the simplest IMO.
It could be me but I imagine it would be confusing for a new user to see a signature saying drop is a keep lol.
It is a type annotation. The type annotation should mean they both have the same type. It doesn't mean they have the same semantics. :)
Just pushed up a change. I think the predicate_fun
type strikes a balances between clarity (mirroring the "predicate function" language from the documentation) and simplicity (just 1 extra type). Let me know if you'd like any more changes!
:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:
I forgot to update this in 3fde8304532670af7ebf57cbb041103be8a15774. Now we're using the same
keep_fun
type for bothkeep
anddrop
to prevent them getting out-of-sync.