moodymudskipper / tags

A collection of tags built using the package tag
GNU General Public License v3.0
8 stars 0 forks source link

setting_options ? #25

Closed moodymudskipper closed 5 years ago

moodymudskipper commented 5 years ago

strictly is a specific case of setting_options and is named awkwardly, it could be renamed setting_warn as in https://github.com/moodymudskipper/tags/issues/24 but it could also just be removed.

setting_options(warn=-1)$sqrt(-1)

Either :

I tend to favor the latter now, though it ends up a bit more heavy on the eye :

setting_options(list(warn=-1))$sqrt(-1)
# compare to
setting_options(warn=-1)$sqrt(-1)
setting_warn(-1)$sqrt(-1)
strictly(-1)$sqrt(-1)

But if its use needs to be repeated there's nothing wrong with :

TAG <- setting_options(list(warn=-1))
TAG$sqrt(-1)
moodymudskipper commented 5 years ago

We now have using_options wrapped around withr::with_options, (note: different from rlang::with_options! but same functionality). This works:

using_options(list(warn=-1))$sqrt(-1)