[graalvm-users] Interop from R to Ruby

Chris Seaton chris.seaton at oracle.com
Tue Aug 21 12:12:32 PDT 2018


The Ruby side of that seems correct. I don’t know if that’s the right way to make a polyglot call (an `EXECUTE`) in R though - need someone from that team to comment.

Chris

> On 21 Aug 2018, at 18:56, Rodrigo Botafogo <rodrigo.a.botafogo at gmail.com> wrote:
> 
> Hello…
> 
> I’ve being accessing R from Ruby with success with calls to Polyglot.eval. like:
> 
> func = Polyglot.eval(“R”, “c”).call(1, 2, 3)
> 
> I’m now trying to do a callback from R to Ruby. I’ve tried something like:
> 
> class Callback
> 
>   def f(x, y)
>     Math.cos(y) / (1 + x^2)
>   end
> 
> end
> 
> remote = Polyglot.eval("R", <<-R)
> function(rb_method) {
>    rb_method.call(1, 2)
>  }
> R
> 
> remote.call(Callback.new.method(:f))
> 
> But this doesn’t work. Is there an easy way of making this callback? And what about sending an instance of a class instead of a function?
> 
> Thanks
> 
> -- 
> Rodrigo Botafogo
> 
> _______________________________________________
> GraalVM-Users mailing list
> GraalVM-Users at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/graalvm-users




More information about the GraalVM-Users mailing list