At 05:00 PM 9/6/2001 +0100, Dave Mitchell wrote:
>Dan Sugalski <[EMAIL PROTECTED]> wrote:
> > What we're going to do is have a get_temp opcode to fetch temporary PMCs.
> > Where do they come from? Leave a plate of milk and cookies on your back
> > porch and the Temp PMC Gnomes will bring them. :)
>
>Ah, things are starting to make sense!
See? I told you it would! Trust the Good Folk, they make your program run. :)
> > new P0, list # New list in P0
> > get_lex P1, $x # Find $x
> > get_type I0, P1 # Get $x's type
> > set_i I1, 1 # Set our loop var
> > $10: new P2, I0 # Get a temp of the same type as $x
> > add P2, P1, I1 # Add counter to $x, store result in P2
> > push P0, P2 # Push it into the list
> > eq I1, 65, $20, $10 # If loop counter's 65 goto $20, else $10
> > $20 call foo # Call the sub
> >
>
>should "new P2, I0" be "get_temp P2, I0" given what you said on the
>first line above?
Hmmm. Yes, in fact it should. That code will end up with a list of 65
identical scalars in it. Bad Dan! No cookie for me.
>Also, it would be nice to have
>
> new P0, list, 65
>
>to pre-extend the list, as the compiler knows in advance how many args
>it's going to push. But I'm bikeshedding now :-)
That'll probably be:
get_temp P0
new P0, list
Dunno about preextending (which isn't bikeshedding, FWIW) since it doesn't
quite do what you want with arrays, and lists will be an awful lot like arrays.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk