[Rd] stopifnot

2019-02-24 Thread Suharto Anggono Suharto Anggono via R-devel
>From https://github.com/HenrikBengtsson/Wishlist-for-R/issues/70 :
... and follow up note from 2018-03-15: Ouch... in R-devel, stopifnot() has 
become yet 4-5 times slower;

...
which is due to a complete rewrite using tryCatch() and withCallingHandlers().


>From https://stat.ethz.ch/pipermail/r-devel/2017-May/074256.html , it seems 
>that 'tryCatch' was used to avoid the following example from giving error 
>message with 'eval' call and 'withCallingHandlers' was meant to handle similar 
>case for warning.
tst <- function(y) { stopifnot(is.numeric(y)); y+ 1 }
try(tst())

However,
withCallingHandlers(,
warning = function(w) { w$call <- cl.i; w })
actally has no effect. In current code of function 'stopifnot', 'eval' is used 
only in handling stopifnot(exprs=) . The warning message from
stopifnot(exprs={warning()})
has 'eval' call:
In eval(cl.i, envir = envir) : 

This may work.
withCallingHandlers(,
warning = function(w) {
w$call <- cl.i; warning(w); invokeRestart("muffleWarning") })


Current documentation says:
Since R version 3.5.0, expressions are evaluated sequentially, and hence 
evaluation stops as soon as there is a "non-TRUE", asnindicated by the above 
conceptual equivalence statement. Further, when such an expression signals an 
error or warning, its conditionCall() no longer contains the full stopifnot 
call, but just the erroneous expression.

I assume that "no longer contains ..." is supposed to be the effect of the use 
of 'withCallingHandlers' and 'tryCatch' in 'stopifnot'.

Actually, "contains the full stopifnot call" is not always the case in R before 
version 3.5.0. Normally, the call is the "innermost context".

Example:
stopifnot((1:2) + (1:3) > 0)
Warning message:
In (1:2) + (1:3) :
  longer object length is not a multiple of shorter object length

Example that gives error:
stopifnot(is.na(log("a")))
R 3.5.0:
R 3.3.2:

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] pcre problems

2019-02-24 Thread robin hankin
Hi there, ubuntu 18.04.2, trying to compile R-devel  3.6.0,  svn 76155.

I am having difficulty compiling R. I think I have pcre installed correctly:

OK~/Downloads/R-devel pcretest -C
PCRE version 8.41 2017-07-05
Compiled with
  8-bit support
  UTF-8 support
  No Unicode properties support
  No just-in-time compiler support
  Newline sequence is LF
  \R matches all Unicode newlines
  Internal link size = 2
  POSIX malloc threshold = 10
  Parentheses nest limit = 250
  Default match limit = 1000
  Default recursion depth limit = 1000
  Match recursion uses stack
OK~/Downloads/R-devel


But ./configure gives me this:

[snip]
checking for pcre.h... yes
checking pcre/pcre.h usability... no
checking pcre/pcre.h presence... no
checking for pcre/pcre.h... no
checking if PCRE version >= 8.20, < 10.0 and has UTF-8 support... no
checking whether PCRE support suffices... configure: error: pcre >=
8.20 library and headers are required
OK~/Downloads/R-devel

can anyone advise?






hankin.ro...@gmail.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel