[Ironruby-core] define_method behaves different than MRI

Tomas Matousek Tomas.Matousek at microsoft.com
Sun Oct 11 23:51:24 EDT 2009


Have a fix for this.
Thanks for the simple repro!

Tomas

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero
Sent: Saturday, October 10, 2009 9:41 AM
To: ironruby-core
Subject: [Ironruby-core] define_method behaves different than MRI

Hi

this used to work but now doesn't anymore


» ir
IronRuby 0.9.1.0 on .NET 2.0.50727.4927
Copyright (c) Microsoft Corporation. All rights reserved.

>>> class SomeClass
... define_method(:initialize) do |*args|
... puts args.join(", ")
... end
... end
=> #<Proc:0x0000056@(unknown):2>
>>> SomeClass.new 1, 4, 6, 3
:0: wrong number of arguments (4 for 0) (ArgumentError)

>>> exit
+ C:\dev
» irb
irb(main):001:0> class SomeClass
irb(main):002:1> define_method(:initialize) do |*args|
irb(main):003:2* puts args.join(", ")
irb(main):004:2> end
irb(main):005:1> end
=> #<Proc:0x0442490c@(irb):2>
irb(main):006:0> SomeClass.new 1, 4, 6, 3
1, 4, 6, 3
=> #<SomeClass:0x4416c08>
irb(main):007: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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091012/22716079/attachment.html>


More information about the Ironruby-core mailing list