<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 8, 2020 at 3:45 PM Joshua N Pritikin <<a href="mailto:jpritikin@pobox.com">jpritikin@pobox.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, Feb 08, 2020 at 03:28:22PM -0500, JJ Allaire wrote:<br>
>    Agreed that it would be good to have more clear docs here. Note <br>
>    that as Dirk pointed out both Writing R Extensions and <br>
>    RcppParallel docs are pretty clear about the fact that you <br>
>    shouldn't call any R APIs when in a background thread.<br>
<br>
Rcpp::stop superficially looks like a nice way to throw C++ exceptions <br>
that also does printf style message formatting. I didn't realize that <br>
it calls R APIs until I looked at the implementation.<br></blockquote><div><br></div><div>That's a good point, I had forgotten about the printf stuff which is a good reason to prefer it to "regular" exceptions.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Sure, but does it *have* to be that way? It seems to me that<br>
exceptions.h line 40,<br>
<br>
  rcpp_set_stack_trace(Shield<SEXP>(stack_trace()))<br></blockquote><div><br></div><div>Not sure about whether this is indeed a mandatory constraint (I didn't work on the stack trace bit).</div></div></div>