Closed ColinFay closed 5 years ago
Yes I agree that it could be painful to put the L. as.integer
could be a solution.
Where is the error coming from? Which check causes this ?
You can open a PR to discuss the fix. Your suggestion seems ok.
Ok this is what is happening
> cr <- Chrome$new(debug_port = 9234)
Error: is_scalar_integer(x = debug_port) is not TRUE
Call `rlang::last_error()` to see a backtrace
I think we don't use as.integer
because it does seems strange that 1.5 cast to 1.
and vctrs
is safer than R base on this
vctrs::vec_cast(1.5, integer())
#> Lossy cast from `x` <double> to `to` <integer>.
#> Locations: 1
vctrs::allow_lossy_cast(vctrs::vec_cast(1.5, integer()))
#> [1] 1
Created on 2019-10-04 by the reprex package (v0.3.0)
The only time I think about using
L
in the port number is when I get an error about it not being a scalar number.I think that in the unlikely event of someone passing
1234.5
as a port number, rounding would be ok.I suggest to automatically turn the port number to integer, instead of forcing the
L
notation.