[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Speed comparison (now scoping)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 4 Jun 1999 21:05:27 -0300 (EST)
>From lua-l@tecgraf.puc-rio.br Fri Jun 4 18:47:11 1999
>From: rw20@cornell.edu
>
>> Here's another possibility: if you created a getglobal and setglobal
>> tag that worked on everything, you could implement something yourself.
>> (Personally, I would just disable global assignment once all the functions
>> are defined.)
>>
>> I'm not sure what the speed penalty would be for that. Obviously, since I
>> don't assign to globals very often, a setglobal tag wouldn't slow things
>> down much. getglobal might be too slow, though, since it would be used on
>> all function calls. I could live with just a setglobal tag, though.
>
>I could live with just the setallglobal tag too. It would be a great
>addition to lua. getallglobal would be good if it didn't slow things
>down.
Unless I'm missing something, there's no need for a setallglobal.
The setglobal for nil suffices because when a global is created, its value
is nil. Then, inside the tag method you create a table wrapper for the global
and give this table a tag. This same tag method is used for the setglobal
for this tag.
I can come up with some code if it's still obscure.
--lhf