I was getting an error trying to use ScriptEngine to require 'win32ole' (Actually, I need this from C#, below example given because its easier to show in IronRuby):
>>> IronRuby.create_engine.execute_file('Libs\win32ole.rb') :0: `&' interpreted as argument prefix (Microsoft::Scripting::SyntaxErrorException) Looks like it fails on this line(63): result = strongly_typed_enumerable.each &b #result = strongly_typed_enumerable.each(&b) #Works just fine if we add parens around &b However, ir.exe reads the file with NO error if we just do a normal "require". This is where I'm not sure if this is a bug. Do ScriptEngine and IR.exe (run interactively ONLY) have stricter parsing requirements? I investigated a bit further to get a simpler repro and found some interesting results. Fine processing the code directly: >ruby -e"b = lambda { |x| p x };result = [1,2].each &b" 1 2 >rbx -e"b = lambda { |x| p x };result = [1,2].each &b" 1 2 Argument error comes ONLY when running interactively (or through the ScriptEngine as shown above): >irb irb(main):001:0> b = lambda { |x| p x };result = [1,2].each &b 1 2 => [1, 2] >rbx IronRuby 0.9.1.0 on .NET 2.0.50727.3082 Copyright (c) Microsoft Corporation. All rights reserved. >>> b = lambda { |x| p x };result = [1,2].each &b unknown: `&' interpreted as argument prefix (Microsoft::Scripting::SyntaxErrorException) Again, fine through ir.exe interactive if I parameterize the block: b = lambda { |x| p x };result = [1,2].each(&b) Thanks Best Regards, Kevin _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core