In irb (and rspec) []= plus method_missing behavior differs from MRI's
----------------------------------------------------------------------
Key: JRUBY-2100
URL: http://jira.codehaus.org/browse/JRUBY-2100
Project: JRuby
Issue Type: Bug
Components: Interpreter
Affects Versions: JRuby 1.1RC1, JRuby 1.1RC2
Environment: macosx, but should (probably) be plaform-independent
Reporter: Yurii Rashkovskii
In jruby and ruby this file works just fine:
=== jruby_bug.rb ====
class Document
def []=(slotname,value)
'1234'
end
def method_missing(sym,*args,&block)
sym = sym.to_s
if sym[-1,1] == '='
send(:[]=,sym.chomp('='),*args)
end
end
end
a = Document.new
puts (a.__lamport_timestamp__ = "world")
=========
verbmac:~ yrashk$ ~/Development/tools/jruby/bin/jruby jruby_bug.rb
world
verbmac:~ yrashk$ ruby jruby_bug.rb
world
But if we'll load this file into irb:
ruby
===
$ irb
irb(main):001:0> load 'jruby_bug.rb'
world
=> true
jruby
===
$ ~/Development/tools/jruby/bin/jirb
irb(main):001:0> load 'jruby_bug.rb'
1234
=> true
So.. it might be not that significant (hey, only jirb is affected) but it
appears that due to some reasons this bug reproduced when running rspec on
jruby, so I suppose it's important.
Here are used versions:
$ ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1]
$ ~/Development/tools/jruby/bin/jruby --version
ruby 1.8.6 (2008-02-09 rev 5512) [i386-jruby1.1RC1]
(jruby is from today's trunk)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email