truffleruby icon indicating copy to clipboard operation
truffleruby copied to clipboard

Array inject accept strings

Open wasabigeek opened this issue 1 year ago • 4 comments

Attempt to address https://github.com/oracle/truffleruby/issues/2931. This expands the specialisations for InjectNode to accept strings in place of symbols.

Local test:

➜  truffleruby git:(master) ✗ jt ruby -e "p [2,3].inject('*')"
$ /.../ruby \
  --experimental-options \
  --core-load-path=/.../truffleruby/src/main/ruby/truffleruby \
  -e \
  p\ \[2,3\].inject\(\'\*\'\)
6
➜  truffleruby git:(master) ✗ jt ruby -e "p [2,3].inject(3, '*')"
Using Interpreted TruffleRuby: mxbuild/truffleruby-jvm
$ /.../truffleruby/mxbuild/truffleruby-jvm/languages/ruby/bin/ruby \
  --experimental-options \
  --core-load-path=/.../truffleruby/src/main/ruby/truffleruby \
  -e \
  p\ \[2,3\].inject\(3,\ \'\*\'\)
18

wasabigeek avatar Feb 01 '24 09:02 wasabigeek

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA). The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

Thank you for signing the OCA.

I'd like to give it a try! May take some time to get back to this, hope that's alright

wasabigeek avatar Feb 06 '24 01:02 wasabigeek

Yes, that's fine, there is no urgency for this issue/PR. If you need any help feel free to ask @nirvdrum or on the GraalVM Slack truffleruby channel.

eregon avatar Feb 06 '24 12:02 eregon

Closing this PR in favor for #3596.

andrykonchin avatar Jun 21 '24 13:06 andrykonchin