Hi Gabriel,
On 10/16/19 1:52 PM, Gabriel Ivăncescu wrote:
And the context changes are not reflected by earlier typeinfos, so the duplication is necessary, each of them is "frozen" at the moment it is retrieved
I'm not convinced. Note that we currently store functions and variables in lists and always add new members to the beginning of the list. It means that you may treat each element of the list (head is the most interesting element) as an immutable (or "frozen") snapshot of current context. Storing current head of variables and functions lists in TypeInfo should be enough, AFAICS.
If you need something more sophisticated, it should be possible to change how we store the context in a way that we could retrieve such a snapshot easily. I can imagine compiler storing global functions and variables in a separate collection that is immutable. It would probably have to be recreated whenever something changes (which is rare), but it could be efficiently use across vbscript.
Thanks,
Jacek