[graalvm-users] RC6 to_s behavior changed

Chris Seaton chris.seaton at oracle.com
Thu Sep 13 08:54:47 PDT 2018


Hello Rodrigo,

The old behaviour worked because to_s called Java’s toString. We changed that to call Ruby’s inspect instead. It was decided across all Truffle languages that we shouldn’t be relying on Java’s toString behaviour, because there’s no contract on what that should be for Truffle languages.

I think this change was part of the proposed interop change log I sent you on the 24th for your opinions, but I wouldn’t blame you for missing it as it was a long list and it’s hard to see how they all apply to your codebase.

What we need is a proper Truffle contract for converting values to strings.

Let us know what you think it should be.

Chris

> On 13 Sep 2018, at 16:36, Rodrigo Botafogo <rodrigo.a.botafogo at gmail.com> wrote:
> 
> Hello...
> 
> In rc5 with the following code:
> 
> p1 = Polyglot.eval("R", 'as.formula').call("medv ~ lstat + age")
> p p1
> p p1.to_s
> 
> I get the following result:
> 
> #<Truffle::Interop::Foreign at 2a984952>
> "language(medv ~ lstat + age)"
> 
> in rc6, the same code prints:
> 
> #<Foreign [#<Foreign:0x49d979c4>, #<Foreign:0x3ba5c4dd>, #<Foreign [#<Foreign:0x47fca3cc>, #<Foreign:0x55746340>, #<Foreign:0x6a0c7af6>]>]>
> "#<Foreign [#<Foreign:0x49d979c4>, #<Foreign:0x3ba5c4dd>, #<Foreign [#<Foreign:0x47fca3cc>, #<Foreign:0x55746340>, #<Foreign:0x6a0c7af6>]>]>"
> 
> The old behavior is preferred, if possible.
> 
> 
> 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