On Tue, Jul 11, 2006 at 04:31:36PM -0700, Chip Salzenberg wrote: > > There's a PIR file already in svn somewhere in Parrot where a :immediate > function is used to build a large table programmatically at compile time, so > that at runtime it's already completely available. That's neat.
Yep. It'll probably doesn't effect the bench time much, but it's used in examples/shootout/revcomp.pir: # create tr table at compile-time # tr{wsatugcyrkmbdhvnATUGCYRKMBDHVN} # {WSTAACGRYMKVHDBNTAACGRYMKVHDBN}; .sub tr_00_init :immediate ... .return(tr_array) .end > Now think about the alternatives if your goal is to have the table ready to > go at runtime without any computational overhead at all, e.g. a CRC table. I think tha main problem are side-effects and compile-time vs. run-time differences in e.g. math libs. Maybe we can sanitize the evil thing a bit :-) My mind is split WRT :immediate, heck, I did implement it, OTOH I can forsee a lot of answers: - "I'm reading a file within an :immediate Sub" - - "Don't do that then" leo