in reply to Using vec() from XS
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using vec() from XS
by BrowserUk (Patriarch) on Sep 23, 2008 at 15:18 UTC | |
There should be a way to create a sequence of OPs (containing the required pp_vec) and run it. Could you expand on this a little please? Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
by salva (Canon) on Sep 23, 2008 at 16:13 UTC | |
The C function Perl_op_dump can be used to dump an OP tree once it has been properly build (otherwise it will crash). | [reply] [d/l] [select] |
by BrowserUk (Patriarch) on Sep 24, 2008 at 01:12 UTC | |
1. synthesize an OP o That phrase means absolutely nothing to me! So I perldoc'd; I grepped the sources; I filtered the htmlise perldocs; I googled. Only the latter turned up that phrase. And other than your post above, the only references google has to "synthesizing an[d] op", from the >25 billion web pages it indexes, are: So, could you please explain what you mean by that? I did look at Perl_fold_constants:
and I can relate nothing there to that phrase. So, could you please treat me like the thicko I am, and explain what ... you are suggesting, cos I just do not ... understand! A long time ago, before the dawn of time, a young, budding mechanical engineer was taken to task for a suggestion he made, but failed to be able to explain. The upshot was: If you cannot explain it, you do not really understand it, so you should not suggest it. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by salva (Canon) on Sep 24, 2008 at 07:48 UTC | |
by tsee (Curate) on Sep 24, 2008 at 07:38 UTC | |
Most likely, you already know that Perl is compiled to a tree of ops. pp_vec is one such op type -- corresponding to the Perl vec() function. Now, you could create op structures from XS and inject them into the running program. B::Generate does stuff like that. The one example I'm aware of where this actually works well is List::Util::shuffle. Instead of repeating what's happening there, check for yourself: List::Util XS code. I tried to do something similar in order to get caller() in XS, but that experiment mostly failed. I would not suggest going down that route.
Cheers, | [reply] |