From: Simone Carletti Date: 2011-03-10T05:59:30+09:00 Subject: [ruby-core:35471] MRI silently handles .so files as Ruby sources --0050450176c52f4d0b049e130172 Content-Type: text/plain; charset=ISO-8859-1 Hello, today I noticed that if you have a file called filename.so.rb and you try to require it without specifying the extension, MRI silently understands that it isn't a .so file, will load the content and treat it as Ruby source. # filename.so.rb > puts __FILE__ > > # somefile.rb > require 'filename.so' > > # => /../../filename.so.rb > Other interpreters handle the case in a different way. For example, JRuby won't load the file because it looks for a Ruby extension in a file called filename.so. See http://jira.codehaus.org/browse/JRUBY-5569 I had a small chat with Charles Oliver Nutter (you can read the comments in the JIRA ticket) and I'm curious to know if the way MRI works should be considered a bug, a coincidence or a feature. Thanks, -- Simone Carletti Application Developer Site & Blog: http://www.simonecarletti.com Email: weppos@weppos.net LinkedIn: http://linkedin.com/in/weppos Skype: weppos --0050450176c52f4d0b049e130172 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

today I noticed that if you have a file called fi= lename.so.rb and you try to require it without specifying the extension, MR= I silently understands that it isn't a .so file, will load the content = and treat it as Ruby source.

# filename.so.rb
puts __FILE__
=

# somefile.rb
require 'filename.so'

# =3D> /../../filename.so.rb

Other interpreters handle the case in a different way.=A0
For example, JRuby won't load the file because it looks for a R= uby extension in a file called filename.so.
See=A0http://jira.codehaus.org/browse/JRU= BY-5569

I had a small chat with=A0Charles Oliver Nutter (you ca= n read the comments in the JIRA ticket) and I'm curious to know if the = way MRI works should be considered a bug, a coincidence or a feature.

Thanks,

--
Simone Carletti
=
Application Developer

Site & Blog: http://www.simonecarl= etti.com
Email: weppos@w= eppos.net
LinkedIn: http://linkedin.com/in/weppos
Skype: weppo= s


--0050450176c52f4d0b049e130172--