Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion IMC and variable number of arguments
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Will Coleda  
View profile  
 More options Apr 18 2003, 11:48 am
Newsgroups: perl.perl6.internals
From: w...@coleda.com (Will Coleda)
Date: Fri, 18 Apr 2003 15:04:06 GMT
Local: Fri, Apr 18 2003 11:04 am
Subject: Re: IMC and variable number of arguments
I believe the best way to handle this is to pass a PMC (say, a PerlArray)  
instead of N single registers. You then know you're passing a single
object each time, and can introspect how many there are on the receiving
end.

Or, pass all the fixed parameters normally, and just use the PMC for the
variable part of the args.

Hope this helps. (FYI, I had the same question looking into tcl - the
perl6 implementation already solved the problem, that's where I got the
solution from.)

> Hi,

> I have a question about how to handle a variable number of arguments.
> suppose I have some function that takes 1 argument, but the function
> call is done with 2 (or more). The compiler (actually, the Lua -> parrot
> compiler which I'm working on)
> cannot and will not check on this. How should this be handled in IMC (if
> even possible)

> According to calling_conventions in the imcc/docs dir, it would be
> something like this:

> -- push arguments onto stack and call function
> ..arg y
> ..arg x
> call _foo
> ------------
> ..sub _foo
> saveall
> ..param int a
> /* do something*/
> restoreall
> ret
> ..end

> somehow, the extra argument should be removed from the stack,  or else,
> in time, the stack will be filled with garbage (or won't it?).
> Or is this not possible in imc?

> regards,
> Klaas-Jan

---------------------------------------------
This message was sent using Road Runner's Web-based
e-mail.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.