Variable Arguments

Lähettäjä: "Mystifier" <rohitlodha@hotwireindia.com>
Aihe: Re: Variable Arguments

Hi Robert,

How can you say caller know about the number of arguments. It might be
possible that it call the function with all what he has and caller
responds with "I am being called with too few or too many arguments".
This can be shown as the error you have indicated.

As Mr. Gross pointed out, you can use #arity to find out the number
of arguments for the method from within Ruby.

I'm not quite sure what you're asking, though. Can you try to rephrase
that? Perhaps more importantly, why does the caller need to know the
amount of arguments? I mean the programmer obviously needs to know
how to use a given method, but are you saying the /code/ needs to
know it also? If so, why?

Third question: are you talking program-level or VM-level?

About VM, it is open source and will be uploaded in a week or so.

Regards,
mystifier

E

I am asking VM level. I am currently writing a stack based VM for Ruby
from scratch. It is going to run ruby after compiling it to byte codes.

In the process, I have to think about the bytecodes, the calling
convention etc. A very basic toy could be ready early. I am also looking
out for better performance and am willing to drop / alter ruby
specifications, though my approach is to find a way without opting for
the change.

Currently, I am writing an Interpreter while the specifications are
fluid. Once it is stabilized, I shall move over to jit compiler.

Arity did give me a possible way to resolve my issue. Thanks.

Regards,
Mystifier