I should have said there was no I<documented> PIR syntax help =-). I found a test for C<.flatten_arg> after I saw it on the list, but it wasn't in the IMCC docs. That would have saved me some time...
(That wording, btw, wasn't in there when I wrote my version. Must have missed a sync)
I'm an edge case because I'm mostly an interpreter at the moment. For me, there's an implicit "dynamically" in the question, which C<.flatten_arg> deals with - the only way to get at that dynamically otherwise is to create a sub on the fly. (that I saw).
In any case, the point of my submission, which was to find a better answer to my question, is done. Sorry about the confusion.
I think it's worth mentioning C<.flatten_arg> in the first answer, and the wording of the second answer needs a bit more explanation, perhaps:
You can check the passed PMC parameter count in the subroutine
with the argcP variable (an alias to I3). Remember, the first
eleven PMC parameters are passed in P5 through P15, with
overflow parameters an array-like PMC in P3.
A simpler way is to use the foldup opcode, which creates an array of all passed PMC arguments.
Leopold Toetsch wrote:
William Coleda <[EMAIL PROTECTED]> wrote:
I was going to submit this as a patch, but I ended up with a conflict, and Dan threatened he wouldn't apply it anyway, so I'll just post it here for comment. Feel free to apply any or all of it. I would be very happy to hear of a better way to answer the first question. =-)
Your answer is about compiling a subroutine that does something. What's wrong with the current wording:
How do I generate a sub call with a variable-length parameter list in PIR?
Use unprototyped calls and functions and pass as many arguments as you have.
How to I retrieve the contents of a variable-length parameter list being passed to me?
You can check the passed parameter count in the subroutine with the argcP variable. A simpler way is to use the foldup opcode, which creates an array of all passed arguments.
leo