At 3:05 PM +0100 2/13/02, Angel Faus wrote: >Dan wrote: >>Yep, I've seen their plans. It's less an issue for us, at least as >>far as globals are concerned, since we'll be doing that with >>lexicals. (Python not having lexicals, after all) Globals are a bit >>more interesting, since bytecode-loaded modules can't guarantee >>global positions, since there's no way of knowing at runtime what's >>been stuffed into the global tables already. >> >>Anyway, doing this with lexicals, which we can know at compile time, > >will get us these speed boosts, and has been on the list for ages. > >Oh, I see. Just two quick questions: > >* will sub definition create globals? I mean, does "sub a {}" create >a function PMC and store it into the "a" lexical? or will there be >a separate mechanism for functions?
sub a{} is global. my sub a{} is lexical. A function PMC's created in either case, the only question is where it's stuck. >* Is there any chance that lexicals get mapped to registers, at least >in the cases where the block doesn't use any dynamic features (MY%, >eval, etc..)? Absolutely. Optimizing away lexicals entirely is an issue for the optimizer, and there are some potential problems with doing it in perl (since you can snoop almost anywhere, there are a limited number of places you can optimize variables away entirely). But other languages with less introspection can definitely do that without a problem. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk