Newsgroups: perl.perl6.internals
From: w...@coleda.com (William Coleda)
Date: Fri, 28 May 2004 21:52:15 -0400
Local: Fri, May 28 2004 9:52 pm
Subject: compiler-faq
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. =-) --- =head2 How do I generate a sub call with a variable-length parameter list in PIR? This is currently not trivial. Since there are no PIR or PASM syntax aids As an example, let's say you want to call a method with three arguments, but .sub _disposable Where you'd replace C<...> with a C<Data::Escape::String>'d version of the Since you're generating this C<_disposable> sub on the fly, you now generate ($I0,$S0) = _sub($P1,$P2,$P3) You can, of course, replace the invocation to use a Sub-like PMC instead of Finally, pass along the return values to your caller. .pcc_begin_return Then, you need to invoke the PIR compiler to compile this disposable sub, .local pmc pir_compiler Now, you can run your code. $P1 = find_global "_disposable" This process may be streamlined in the future. =head2 How do I retrieve the contents of a variable-length parameter list being passed to me? The easiest way to do this is to use the C<foldup> opcode to take a variable .sub _mysub If you have a few fixed parameters, you can use a variant of .sub _mysub 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.
| ||||||||||||||