Hi Tomas (and other IronRuby devs). I'm trying to implement this, but I'm 
not sure quite how to go about dynamically invoking the 'message' and 
'backtrace' methods on the other objects.

It looks like the other methods all have a UnaryOpStorage or other kind of 
'storage' that they use to invoke other dynamic methods
 - how do I know what kind of Storage object I need to invoke methods on 
other objects?
 - I'm not sure where I get these storage objects from? It appears that in 
this case the language runtime will pass them in as needed, but if I need 
to call a ruby method from another location (eg inside Marshal.cs), how do 
I go about getting the storage object?

Thanks, Orion



From:   Tomas Matousek 
<reply+c-683915-ae54ce679190ef3de090cba9240521883afb6...@reply.github.com>
To:     Gallagher Group R&D Department <ori...@gallagher.co.nz>
Date:   31/10/2011 06:55 a.m.
Subject:        Re: [ironlanguages-main] Ruby 1.9 marshalling 
compatibility. (630995e)



This doesn't seem to be quite right.
Unfortunately Ruby's exception object might be a bit messed up. Message 
might not be a string, backtrace is always an array (or nil) but it might 
not containg strings. It seems that Ruby calls "==" on the message object 
and then on each item of the backtrace. 

It doesn't look like Ruby is comparing exception classes.

Also an exception can be compared with any object that has "message" and 
"backtrace" methods.

---

class C
  def message
    "hello"
  end
 
  def backtrace
    ["1","2","3"]
  end
end

class D 
  def ==(other)
    p "=="
    true
  end
end

c = C.new
m = D.new
e = Exception.new(m)
a = ["1","2","3"]
e.set_backtrace(a)
a[1] = D.new

p e == c

p e.backtrace.inspect, e.message
p c.backtrace.inspect, c.message

p IOError.new("1") == Exception.new("1")

-- 
Reply to this email directly or view it on GitHub:
https://github.com/gglresearchanddevelopment/ironlanguages-main/commit/630995eca293b5b0531e821b76bab7e15c4506f6#commitcomment-683915


_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to