Thibaut Barrère
2010-Jan-30 13:09 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
Hello,
maybe someone can shed some light on that - the question is: is there a
setting to make IronRuby works the same way MRI Ruby does by default for
what I''m describing below ? I don''t think it''s a bug
(but well maybe it is,
just wondering).
Using this script http://gist.github.com/290538 , MRI has a different
behaviour than JRuby or IronRuby.
The script will work just fine in MRI, whereas in JR/IR you''ll get:
(erb):2: undefined local variable or method `version'' for main:Object
(NameError)
from :1:in `eval''
from /opt/local/share/java/jruby/lib/ruby/1.8/erb.rb:743:in
`result''
from binding-error.rb:19
(erb):1: undefined method `version'' for main:Object (NoMethodError)
from C:/IronRuby/lib/ruby/1.8/erb.rb:716:in `result''
from binding-error.rb:19
from :0:in `eval''
It''s just like values.send(:binding) is doing nothing.
any thoughts ?
thanks,
-- Thibaut
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100130/00cab4b6/attachment.html>
Ivan Porto Carrero
2010-Jan-30 13:17 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
AFAIK that shouldn''t work in MRI either
+ C:\dev
? irb
irb(main):001:0> require ''erb''
=> true
irb(main):002:0>
irb(main):003:0* data = { :version => RUBY_PLATFORM }
=> {:version=>"i386-mingw32"}
irb(main):004:0>
irb(main):005:0* class Hash
irb(main):006:1> def method_missing(method,*args)
irb(main):007:2> if (keys.include?(method) && args.empty?)
irb(main):008:3> self[method]
irb(main):009:3> else
irb(main):010:3* super
irb(main):011:3> end
irb(main):012:2> end
irb(main):013:1> end
=> nil
irb(main):014:0>
irb(main):015:0* x = 42
=> 42
irb(main):016:0> template = ERB.new <<-EOF
irb(main):017:0" The value of x is: <%= version %>
irb(main):018:0" EOF
=> #<ERB:0x26a53e0 @safe_level=nil, @src="#coding:CP850\n_erbout =
'''';
_erbout.concat \" The value of x is: \"; _erbout.concat(( version
).to_s);
_erbout.concat \"\\n\"\n; _erbout.force_encoding(__ENCODING__)",
@enc=#<Encoding:CP850>, @filename=nil>
irb(main):019:0> puts template.result(data.send(:binding))
NameError: undefined local variable or method `version'' for main:Object
from (erb):1
from C:/Ruby/lib/ruby/1.9.1/erb.rb:753:in `eval''
from C:/Ruby/lib/ruby/1.9.1/erb.rb:753:in `result''
from (irb):19
from C:/Ruby/bin/irb:12:in `<main>''
irb(main):020:0>
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
On Sat, Jan 30, 2010 at 2:09 PM, Thibaut Barr?re
<thibaut.barrere at gmail.com>wrote:
> Hello,
>
> maybe someone can shed some light on that - the question is: is there a
> setting to make IronRuby works the same way MRI Ruby does by default for
> what I''m describing below ? I don''t think it''s a
bug (but well maybe it is,
> just wondering).
>
> Using this script http://gist.github.com/290538 , MRI has a different
> behaviour than JRuby or IronRuby.
>
> The script will work just fine in MRI, whereas in JR/IR you''ll
get:
>
> (erb):2: undefined local variable or method `version'' for
main:Object
> (NameError)
> from :1:in `eval''
> from /opt/local/share/java/jruby/lib/ruby/1.8/erb.rb:743:in
`result''
> from binding-error.rb:19
>
> (erb):1: undefined method `version'' for main:Object
(NoMethodError)
> from C:/IronRuby/lib/ruby/1.8/erb.rb:716:in `result''
> from binding-error.rb:19
> from :0:in `eval''
>
> It''s just like values.send(:binding) is doing nothing.
>
> any thoughts ?
>
> thanks,
>
> -- Thibaut
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100130/17d08055/attachment.html>
Thibaut Barrère
2010-Jan-30 13:41 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
Hey Ivan, thanks for your answer. I redid the test on: - Mac OS X (mri ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]) => http://gist.github.com/290538#file_test_on_mac_os_x.txt - Windows 7 (mri ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]) => http://gist.github.com/290538#file_test_on_windows.txt And it works on both apparently... There must be a reason... Which version of Ruby/IRB are you using ? -- Thibaut -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100130/0cd0f6af/attachment.html>
Ivan Porto Carrero
2010-Jan-30 14:00 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
mine was on windows with ruby 1.9.1 though.. I don''t have a 1.8 around
to
see if that same test works with 1.8 on windows. In 1.9.1 the tweaked stuff
works too
+ C:\dev
? irb
irb(main):001:0> require ''erb''
=> true
irb(main):002:0> require ''ostruct''
=> true
irb(main):003:0>
irb(main):004:0* class OpenStruct
irb(main):005:1> def get_our_own_binding
irb(main):006:2> binding
irb(main):007:2> end
irb(main):008:1> end
=> nil
irb(main):009:0>
irb(main):010:0* class Templator
irb(main):011:1> def self.render(template,values)
irb(main):012:2> template = ERB.new(template)
irb(main):013:2> context = OpenStruct.new(values)
irb(main):014:2> template.result(context.get_our_own_binding)
irb(main):015:2> end
irb(main):016:1> end
=> nil
irb(main):017:0>
irb(main):018:0* template = <<-EOF
irb(main):019:0" The value of x is: <%= version %>
irb(main):020:0" EOF
=> " The value of x is: <%= version %>\n"
irb(main):021:0>
irb(main):022:0* puts Templator.render(template, { :version => RUBY_PLATFORM
})
The value of x is: i386-mingw32
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
On Sat, Jan 30, 2010 at 2:41 PM, Thibaut Barr?re
<thibaut.barrere at gmail.com>wrote:
> Hey Ivan,
>
> thanks for your answer.
>
> I redid the test on:
> - Mac OS X (mri ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0])
> => http://gist.github.com/290538#file_test_on_mac_os_x.txt
> - Windows 7 (mri ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32])
> => http://gist.github.com/290538#file_test_on_windows.txt
>
> And it works on both apparently...
>
> There must be a reason... Which version of Ruby/IRB are you using ?
>
> -- Thibaut
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100130/e7dcc28d/attachment.html>
Thibaut Barrère
2010-Jan-30 14:09 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
Thanks - that''s probably a 1.8 specific thing... We''ll see what others have to say on Monday :) Thanks for your tests! -- Thibaut -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100130/6df14e56/attachment-0001.html>
Tomas Matousek
2010-Feb-01 16:50 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
It should work as soon as we push the latest source out.
Tomas
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Thibaut Barr?re
Sent: Saturday, January 30, 2010 5:10 AM
To: ironruby-core
Subject: [Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
Hello,
maybe someone can shed some light on that - the question is: is there a setting
to make IronRuby works the same way MRI Ruby does by default for what
I''m describing below ? I don''t think it''s a bug (but
well maybe it is, just wondering).
Using this script http://gist.github.com/290538 , MRI has a different behaviour
than JRuby or IronRuby.
The script will work just fine in MRI, whereas in JR/IR you''ll get:
(erb):2: undefined local variable or method `version'' for main:Object
(NameError)
from :1:in `eval''
from /opt/local/share/java/jruby/lib/ruby/1.8/erb.rb:743:in
`result''
from binding-error.rb:19
(erb):1: undefined method `version'' for main:Object (NoMethodError)
from C:/IronRuby/lib/ruby/1.8/erb.rb:716:in `result''
from binding-error.rb:19
from :0:in `eval''
It''s just like values.send(:binding) is doing nothing.
any thoughts ?
thanks,
-- Thibaut
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100201/a1959a0d/attachment-0001.html>
-------------- next part --------------
An embedded message was scrubbed...
From: Tomas Matousek <Tomas.Matousek at microsoft.com>
Subject: Code Review: bindingandyamlfxcop
Date: Mon, 1 Feb 2010 16:49:12 +0000
Size: 46840
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100201/a1959a0d/attachment-0001.mht>
Thibaut Barrère
2010-Feb-01 17:01 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
Hi Thomas,> It should work as soon as we push the latest source out.thanks for the update (note that I''m in no hurry on these bugs - I''m just pushing what I find as I go, based on the MSI release, and using workaround whenever necessary). cheers, -- Thibaut> Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Thibaut Barr?re > *Sent:* Saturday, January 30, 2010 5:10 AM > *To:* ironruby-core > *Subject:* [Ironruby-core] Differences between 1/ MRI and 2/ > IronRuby+JRuby > > > > Hello, > > maybe someone can shed some light on that - the question is: is there a > setting to make IronRuby works the same way MRI Ruby does by default for > what I''m describing below ? I don''t think it''s a bug (but well maybe it is, > just wondering). > > Using this script http://gist.github.com/290538 , MRI has a different > behaviour than JRuby or IronRuby. > > The script will work just fine in MRI, whereas in JR/IR you''ll get: > > (erb):2: undefined local variable or method `version'' for main:Object > (NameError) > from :1:in `eval'' > from /opt/local/share/java/jruby/lib/ruby/1.8/erb.rb:743:in `result'' > from binding-error.rb:19 > > (erb):1: undefined method `version'' for main:Object (NoMethodError) > from C:/IronRuby/lib/ruby/1.8/erb.rb:716:in `result'' > from binding-error.rb:19 > from :0:in `eval'' > > It''s just like values.send(:binding) is doing nothing. > > any thoughts ? > > thanks, > > -- Thibaut > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100201/9de7363f/attachment.html>
Jim Deville
2010-Feb-01 18:16 UTC
[Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby
We should be doing an MSI in the next few weeks. JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Thibaut Barr?re Sent: Monday, February 01, 2010 9:02 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby Hi Thomas,> It should work as soon as we push the latest source out.thanks for the update (note that I''m in no hurry on these bugs - I''m just pushing what I find as I go, based on the MSI release, and using workaround whenever necessary). cheers, -- Thibaut Tomas From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Thibaut Barr?re Sent: Saturday, January 30, 2010 5:10 AM To: ironruby-core Subject: [Ironruby-core] Differences between 1/ MRI and 2/ IronRuby+JRuby Hello, maybe someone can shed some light on that - the question is: is there a setting to make IronRuby works the same way MRI Ruby does by default for what I''m describing below ? I don''t think it''s a bug (but well maybe it is, just wondering). Using this script http://gist.github.com/290538 , MRI has a different behaviour than JRuby or IronRuby. The script will work just fine in MRI, whereas in JR/IR you''ll get: (erb):2: undefined local variable or method `version'' for main:Object (NameError) from :1:in `eval'' from /opt/local/share/java/jruby/lib/ruby/1.8/erb.rb:743:in `result'' from binding-error.rb:19 (erb):1: undefined method `version'' for main:Object (NoMethodError) from C:/IronRuby/lib/ruby/1.8/erb.rb:716:in `result'' from binding-error.rb:19 from :0:in `eval'' It''s just like values.send(:binding) is doing nothing. any thoughts ? thanks, -- Thibaut _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100201/1d1d8f42/attachment-0001.html>