# Strange type error

**URL:** <https://www.ruby-forum.com/t/strange-type-error/167847>\
**Category:** IronRuby\
**Created:** [May 13, 2009, 8:50am UTC](https://www.ruby-forum.com/t/strange-type-error/167847 "2009-05-13T08:50:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seo\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@Seo\_S](https://www.ruby-forum.com/u/Seo_S)\
**Post date:** [May 13, 2009, 8:50am UTC](https://www.ruby-forum.com/t/strange-type-error/167847/1 "2009-05-13T08:50:36Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![Seo\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@Seo\_S](https://www.ruby-forum.com/u/Seo_S)\
**Post date:** [May 13, 2009, 9:05am UTC](https://www.ruby-forum.com/t/strange-type-error/167847/2 "2009-05-13T09:05:52Z")

</div>

I have seen that error message. The fix was the one-line change in  
Protocols.cs in  
["numeric + someOtherObj" should call someOtherObj.method\_missing(:coe… · shri-zz/ironruby@09b25e8 · GitHub](http://github.com/shri/ironruby/commit/09b25e8c573464dc5868ab2521bd631a013527c7).  
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.

---

<div class="post-metadata">

**Author:** ![Seo\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@Seo\_S](https://www.ruby-forum.com/u/Seo_S)\
**Post date:** [May 13, 2009, 9:28am UTC](https://www.ruby-forum.com/t/strange-type-error/167847/3 "2009-05-13T09:28:10Z")

</div>

2009/5/13 Shri B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have seen that error message. The fix was the one-line change in Protocols.cs in ["numeric + someOtherObj" should call someOtherObj.method\_missing(:coe… · shri-zz/ironruby@09b25e8 · GitHub](http://github.com/shri/ironruby/commit/09b25e8c573464dc5868ab2521bd631a013527c7). 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.

---

<div class="post-metadata">

**Author:** ![Seo\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@Seo\_S](https://www.ruby-forum.com/u/Seo_S)\
**Post date:** [May 13, 2009, 6:30pm UTC](https://www.ruby-forum.com/t/strange-type-error/167847/4 "2009-05-13T18:30:25Z")

</div>

[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1211](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1211)

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
