r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
498 stars 136 forks source link

let `cnd_signal()` take `.frequency` arg #1729

Open maxheld83 opened 1 month ago

maxheld83 commented 1 month ago

I want to separately construct conditions with *_cnd() and signal them with cnd_signal(). As far as I can see, it is currently not possible to set a .frequency (and id) for a condition thus signaled, though this is possible when creating and signaling in one go with, say inform().

There may be a good reason for this, so apologies if this doesn't make sense.

I was hoping for a .frequency (and id) argument to cnd_signal(), but could not find that.

It makes sense to me that you'd set `.frequency` in `cnd_signal()`, not `*_cnd()`, since `cnd_signal()` is the place where you emit the side-effect. (Also, setting `.frequency` in `*.cnd()` could get quite thorny if these conditions are chained together).