From: Robert Klemme Date: 2005-01-12T01:36:25+09:00 Subject: Re: Variable Arguments schrieb im Newsbeitrag news:000a01c4f7fa$30251dc0$1a87103d@vubydump... > Hi > > Ruby has a variable argument syntax as well as fixed number of arguments > syntax. The caller does not know about how the called function's syntax. The caller can in fact know the number of arguments at runtime: >> class Foo >> def f1(a)end >> def f2(*a)end >> def f3(a,*b)end >> end => nil >> f=Foo.new => # >> f.method("f1").arity => 1 >> f.method("f2").arity => -1 >> f.method("f3").arity => -2 And you'll see an error if the arguments passed do not match: >> f.f1(1,2,3) ArgumentError: wrong number of arguments(3 for 1) from (irb):11:in `f1' from (irb):11 > In case of variable arguments, it is expected caller to provide with > number of arguments while for the other case it might not. I'm sorry, I don't understand what you mean by this. > Since, I am writing a VM for Ruby, I would like to know how should one > handle this problem? As I'm currently mystified by your question I can't come up with an answer. Could you please clarify this? And what kind of VM are you writing? Kind regards robert