Skip to content

Polyglot value in R only code #66

@rbotafogo

Description

@rbotafogo

I'm running the following code from Ruby, in RC14 ('rlang' and 'purrr') have already been loaded:

Polyglot.eval("R", <<-R)
  fidx = function(idx) {
      print(typeof(idx))
      print(class(idx))
      print(idx)
      print(is_missing(idx))
  }

  ma = missing_arg()
  f = fidx
  params = list()
  params = `[[<-`(params, 1, ma)
  invoke(f, params)

  print("======")
  fidx(ma)

R

The output of this code is:

[1] "NULL"
[1] "NULL"
[polyglot value]
[1] TRUE
[1] "======"
[1] "symbol"
[1] "name"

[1] TRUE

Note that the first time 'print(idx)' is called it outputs [polyglot value], but this should not be so, since the whole code is inside a single Polyglot call.

Also if running this code in gnuR, gives:

Error in typeof(idx) : argument "idx" is missing, with no default 

Even the call 'fidx(ma)' that does what I wanted, in gnuR actually does not work and give the same error as above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions