develooper Front page | perl.perl6.internals | Postings from July 2002

Re: Subs?

Thread Previous | Thread Next
Melvin Smith
July 17, 2002 21:04
Re: Subs?
Message ID:
At 09:16 PM 7/17/2002 -0400, Dan Sugalski wrote:
>Melvin (and the rest of you... :)
>Are subroutine PMCs at a point where we can use them? If not, that's fine, 
>but if so, they can go on the list 'o things. (And we can add global 
>variables, if they didn't make it in the 0.0.6 release notes)

Subs, co-routines and continuations are at a very limited, but functional

Basically you can create a PMC with a bytecode address or label
and use the call/callco/callcc ops on it.

We can:
-capture and restore continuations.
-call, yield and re-call coroutines.
-call plain subs

-The ops are wrong, they should be PMC methods
-For continuations the stack frames currently won't
  get collected (I started work on it). Also you have to turn off the garbage
  collector to play around with continuations, since I haven't put in the
  custom mark routine yet.
-Since we have no symbol tables yet, you have to create them at runtime.
-We have no lexicals so only registers and stack work for the closure variables
-The save/restore of a context is currently a bit more expensive
   than it has to be, but it works.
-COW copies the whole stack for continuations, but I think I already put in
  a patch that reworked stacks enough to allow COW on a chunk by chunk
-About 100 other things

Sometime in the last couple of months I mailed samples of co-routines
and continuations to the list. I'll try to dig that up if you don't have it.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About