Hello, this is my first post on Discourse…
I’m porting a library of functions from R to Julia (and getting significant speedups). So it’s handy to use RCall to test the R version of a function against the Julia version. It’s also handy to use Debugger to step through code when chasing down differences between the two versions of a function.
But I find that I cannot debug calls to RCall.reval
. An error is thrown MethodError: no method matching iterate(::Type{Ptr{RCall.SxpHead}})
, as shown in the example below.
Question 1
Should I raise an issue for this at the github page for Debugger or that for RCall (or both or neither)?
Question 2
Other than trying the alternative debugger MagneticReadHead (which I’ve only just discovered, and have yet to try) is there a way to step through Julia code that calls into R?
using RCall
function test()
res = reval("1+1")
end
julia> test()
RObject{RealSxp}
[1] 2
julia> @enter test()
In test() at d:\Philip\Source\script\Julia\JSource\xccyHWhooks.jl:374
>1 1 ─ %1 = (RCall.reval)("1+1")
2 │ res = %1
3 └── return %1
About to run: (RCall.reval)("1+1")
1|debug> n
ERROR: MethodError: no method matching iterate(::Type{Ptr{RCall.SxpHead}})
Closest candidates are:
iterate(::Core.SimpleVector) at essentials.jl:568
iterate(::Core.SimpleVector, ::Any) at essentials.jl:568
iterate(::ExponentialBackOff) at error.jl:199
...
Stacktrace:
[1] safe_parseVector(::Ptr{StrSxp}, ::Base.RefValue{Int32}, ::Ptr{NilSxp}) at C:\Users\Philip\.julia\packages\RCall\g7dhB\src\eval.jl:6
[2] rparse_p(::Ptr{StrSxp}, ::Ptr{NilSxp}) at C:\Users\Philip\.julia\packages\RCall\g7dhB\src\eval.jl:49
[3] rparse_p(::String, ::Ptr{NilSxp}) at C:\Users\Philip\.julia\packages\RCall\g7dhB\src\eval.jl:70
[4] rparse_p(::String) at C:\Users\Philip\.julia\packages\RCall\g7dhB\src\eval.jl:70
[5] reval(::String, ::RObject{EnvSxp}) at C:\Users\Philip\.julia\packages\RCall\g7dhB\src\eval.jl:132
[6] reval(::String) at C:\Users\Philip\.julia\packages\RCall\g7dhB\src\eval.jl:132
[7] test() at d:\Philip\Source\script\Julia\JSource\xccyHWhooks.jl:374