[R-pkg-devel] Workaround for code/documentation mismatch

Andrew Simmons @kw@|mmo @end|ng |rom gm@||@com
Wed Aug 11 18:13:39 CEST 2021


Hello,


@Martin Maechler:
%until% and %while% use R's builtin repeat function. Something like

do(expr) %until% (cond)
repeat {
    expr
    if (cond)
        break
}

are identical. After %until% and %while% check the arguments look correct,
it makes a call to repeat like above and evaluates it in the same
environment as %until% or %while% was called from. I haven't completely
reinvented the wheel here.
%until% and %while% are slower than repeat, but only by a microsecond or
two.
Admittedly, my documentation for %until% and %while% is dog water compared
to repeat, but I've tried to make it as clear as possible in my
documentation that %until% and %while% use repeat,
and included the link to the documentation for repeat.


@Duncan Murdoch:
I'll try renaming the arguments, thank you for the suggestion. Also, I
didn't realize you could put R comments in \usage with #, so I might try
that as well, thank you!

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list