ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-internals
perl6-internals
Re: Lexical variables, scratchpads, closures, ...
by Jonathan Sillito other posts by this author
Jul 31 2002 8:23PM messages near this date
Re: Lexical variables, scratchpads, closures, ... | Re: Lexical variables, scratchpads, closures, ...
On Wed, 2002-07-31 at 13:49, Jerome Vouillon wrote:
>  On Wed, Jul 31, 2002 at 11:40:39AM -0600, Jonathan Sillito wrote:

>  >     new_pad   # push this on the lexical stack

>  >               # some constant descriptor should also be passed

>  >               # to the new_pad op which would then know about

>  >               # the lexical variable 'x', and would create an

>  >               # associated pointer object

>  

>  Do you really need a stack?


A stack is how it is currently implemented. As Melvin suggested, this
makes it easy to push an pop scopes as each block is entered and exited.
There is an example of this in examples/assembly/lexicals.pasm

Of course other approaches's are possible.

>  When is the pointer object created?


This part is not implemented currently. Once there is a pad descriptor
that the assembler understands, the pointer object could be created
immediately (maybe pointing to an instance of the PerlUndef pmc?).

BTW: is anyone working on or thinking about pad descriptors right now?

>  

>  >     invoke    # assumes sub is in P0

>  >               # on invoke the sub pmc fixes the current

>  >               # context to have the correct lexicals

>  

>  Can you elaborate on this?  What is done precisely to fix the current

>  context?


This also is not implemented (unless Sean O'Rourke's recent patch does
this?) However the Sub (or Coroutine, or Continuation, or ...) PMC could
have the responsibility of putting the correct context in place before
actually jumping to the body of the sub. Melvin's code in sub.c has a
start on this, I think ... 

I am kind of just thinking out loud here, but does that clear up
anything?
--
Jonathan Sillito


Thread:
Jerome Vouillon
Melvin Smith
Jerome Vouillon
Sean O'Rourke
Jerome Vouillon
Dan Sugalski
Dan Sugalski
Simon Cozens
Nicholas Clark
Sean O'Rourke
Jerome Vouillon
Nicholas Clark
Jerome Vouillon
Jonathan Sillito
Dave Mitchell
Melvin Smith
Sean O'Rourke
Dan Sugalski
Dan Sugalski
Jonathan Sillito
Jerome Vouillon
Melvin Smith
Jerome Vouillon
Melvin Smith
Jerome Vouillon
Jonathan Sillito
Sean O'Rourke

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved