Truffleruby: Object#clone(freeze: boolean) is not supported (available since 2.4 in MRI)

Created on 6 Nov 2018  路  9Comments  路  Source: oracle/truffleruby

This is easily reproducible under truffleruby 1.0.0.rc9. Object#clone(freeze: boolean) option is available since Ruby 2.4. See https://ruby-doc.org/core-2.4.0/Object.html#method-i-clone

Truffleruby 1.0.0 claims it's Ruby 2.4 compatible. So this option would be supported as well.

To reproduce:

Object.new.clone(freeze: true)

Error:

ArgumentError: wrong number of arguments (1 for 0)
    from (irb):1:in `clone'
    from (irb):1
    from ~/.rubies/truffleruby-1.0.0-rc9/bin/irb:29:in `<main>'
bug quick-fix

All 9 comments

Just for a record, here is the original report:

Here is a small script requiring running PostgreSQL. The below code failed during a try to create a table using sequel. No problem with Ruby 2.5.3.

# frozen_string_literal: true

require 'bundler/inline'
require 'logger'

gemfile do
  source 'https://rubygems.org'

  gem 'pg',     '1.1.3'
  gem 'sequel', '5.13.0'
end

DATABASE_URL = 'postgres://postgres:postgres@localhost:5432/truffleruby'

logger = Logger.new($stdout)

DB = Sequel.connect(DATABASE_URL, logger: logger)

DB.create_table?(:exchange_rates) do
  Date :date, primary_key: true
  BigDecimal :rate, size: [8, 4]
end

Error:

$ ruby sequel.rb
I, [2018-11-06T20:39:44.613000 #37428]  INFO -- : (0.019131s) SET standard_conforming_strings = ON
I, [2018-11-06T20:39:44.623000 #37428]  INFO -- : (0.002851s) SET client_min_messages = 'WARNING'
I, [2018-11-06T20:39:44.627000 #37428]  INFO -- : (0.001808s) SET DateStyle = 'ISO'
~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/query.rb:87:in `clone': wrong number of arguments (1 for 0) (ArgumentError)
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/query.rb:87:in `clone'
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/query.rb:263:in `from'
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/dataset.rb:64:in `block in from'
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/misc.rb:281:in `cached_dataset'
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/dataset.rb:64:in `send'
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/dataset.rb:64:in `from'
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/query.rb:196:in `table_exists?'
    from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/schema_methods.rb:221:in `create_table?'
    from sequel.rb:19:in `<main>'

@eregon @chrisseaton I isolated the problem mentioned above.

@eregon I don't want to push on this. This is just a question and I realize you Truffleruby team has own priorities. But I'd like to ask if this can be solved in RC10 release if possible. I'd like to explore more stuff around sequel but this seems to be the major blocker.

It should be easy to fix - we'll try today.

This is a bit trickier than I thought, because #clone is implemented in Java and we don't support these keyword arguments in Java code.

I think I've got a good fix.

That's implemented now and will be in the next release. Thanks for the report. Priortising these issues is very useful to us, so if you have a next one you think is most important, comment on it.

Do you know how to build from source in order to test our fixes?

@chrisseaton I saw https://github.com/oracle/truffleruby/blob/master/doc/contributor/workflow.md But it seems to be a bit complicated. I wanted to create something like truffleruby-dev for ruby-build (where I contribute frequently). Because of the complicated building process I gave up it. I'd appreciate some binary release when I could use chruby/ruby-build. Have you though of building some kind of nightly builds of Truffleruby? Then it would be easy to add to ruby-build and have something like truffleruby-dev.

Anyway, are there some easy steps how to build it on macOS?

@chrisseaton I've pointed several issues on which would be interesting to take a look at.

Was this page helpful?
0 / 5 - 0 ratings