Forum: IronRuby Strange type error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B7b34fda26b7ea99b8b4d42497193220?d=identicon&s=25 Seo Sanghyeon (Guest)
on 2009-05-13 08:50
(Received via mailing list)
Any idea what's going on in the following?

$ gem install chronic

$ cat test.rb
require 'rubygems'
require 'chronic'
puts Chronic.parse('3pm')

$ mono ir.exe test.rb
/var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:68:in
`next': can't convert IronRuby::Builtins::RubyObject into Float
(TypeError)
from
/var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:67:in
`next'
from :0:in `catch'
from mscorlib:0:in `CallSite.Target'
from Microsoft.Scripting.Core:0:in
`invoke_object__this___CallSite_RubyScope_object_Proc_SymbolId'
from
/var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/repeaters/repeater_time.rb:107:in
`this'
from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:348:in
`find_within'
from mscorlib:0:in `CallSite.Target'
from Microsoft.Scripting.Core:0:in
`invoke_object__this___CallSite_RubyScope_object_SymbolId'
from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:326:in
`get_anchor'
from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:219:in
`handle_r'
from
/var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:16707566:in
`tokens_to_span'
from :0:in `__send__'
from mscorlib:0:in `CallSite.Target'
from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/handlers.rb:50:in
`tokens_to_span'
from :0:in `each'
from mscorlib:0:in `CallSite.Target'
from /var/lib/gems/1.8/gems/chronic-0.2.3/lib/chronic/chronic.rb:84:in
`parse'
from test.rb:3
from mscorlib:0:in `CallSite.Target'
Aea6cfe04952626ab630bde47ff82f89?d=identicon&s=25 Shri Borde (Guest)
on 2009-05-13 09:05
(Received via mailing list)
I have seen that error message. The fix was the one-line change in
Protocols.cs in
http://github.com/shri/ironruby/commit/09b25e8c573....
You can apply that change by hand (its not in the main ironruby repo
yet) and see if that fixes the problem. The error message is somewhat
generic, and it may or may not be the same issue.
B7b34fda26b7ea99b8b4d42497193220?d=identicon&s=25 Seo Sanghyeon (Guest)
on 2009-05-13 09:28
(Received via mailing list)
2009/5/13 Shri Borde <Shri.Borde@microsoft.com>:
> I have seen that error message. The fix was the one-line change in Protocols.cs in 
http://github.com/shri/ironruby/commit/09b25e8c573.... You can 
apply that change by hand (its not in the main ironruby repo yet) and see if that fixes 
the problem. The error message is somewhat generic, and it may or may not be the same 
issue.

It didn't fix the problem. Probably a different issue.
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-05-13 18:30
(Received via mailing list)
http://ironruby.codeplex.com/WorkItem/View.aspx?Wo...

IronRuby's Time implementation doesn't allow this, while MRI does.

n = Time.now
class RespondToF
  def to_f
    5.0
  end
end
n + RespondToF.new

Chronic does something like this in repeaters/repeater_time.rb:76

~js
This topic is locked and can not be replied to.