From: john s. <sk...@us...> - 2009-10-07 03:35:26
|
On 07/10/2009, at 3:21 AM, Erick Tryzelaar wrote: > >> However this is NOT enough: when binding D which depends on B >> we still have to lookup in B! At present, there is NO lookup into >> already >> bound >> symbol tables. >> >> this has to be fixed FIRST. It will also speed up lookup, and remove >> the need for a cache (which would be hard to save and restore >> on a module basis). > > > What would we need to do for this? I'm not familiar enough with > binding yet to know where to look for what you're talking about :) When you're binding say a function, it has raw unbound code to bind. This is done by binding all the required components **FROM RAW UNBOUND CODE**. Such bindings are immediately lost. For example: fun f()=> g 1; To calculate f's type we need to bind g. We do that, calc the ret type for r, then forget the binding of g. When we get up to binding g we bind it, and save the result as a BBDCL. We could have bound g 100 times before if it is called 100 times in various places. Even AFTER g is bound, if we see fun h() => g 1; guess what -- we bind g AGAIN. And drop that binding. We never lookup in the bound symbol table to save time, nor save any recursively required bindings in that table. The algorithm is clearly exponential. With some caveats related to recursion binding SHOULD be linear. -- john skaller sk...@us... |