r-lib / rlang

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

docs: Wrap `on_load()` contents in examples with braces #1697

Closed krlmlr closed 6 months ago

krlmlr commented 6 months ago

This gives better tracebacks, I suppose.

lionel- commented 6 months ago

How does it give better tracebacks?

krlmlr commented 6 months ago

I've noticed that srcrefs are available only for braced expressions, not for naked ones. Can't vouch for this specific case, but observed with expect_snapshot() . @hadley: would you like to share your perspective?

lionel- commented 6 months ago

oh yeah that's definitely the case