I commented out the definition because I made mine earlier before I saw your commit. It is true. I don't need the recursive type per se. Nevertheless, I thought it would be more efficient. When we add a variable, all offsets need to be incremented by one. If we use only one map the complexity would be O(n) but when we use two maps (with n = n_i + n_o) then the complexity is only O(n_i). If the global scope (n_o) is a lot larger than all the inner scope used in let/function call we could observer better performances. -- Pierre Delaunay On Mon, Feb 29, 2016 at 6:15 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
+(* Offset is the number to take us out of the inner scope + * Scope is the Mapping between Variable's names and its current index loc + * Offset + Scope *) +type context_impl = int * scope
You commented out my "identical" definition in lexp.ml:
type senv_type = (db_revindex SMap.t * db_index)
so I obviously agree it's a good way to do it.
+(* The recursive type that does everything + * inner Scope * Outer Scope *) +type lexp_context = context_impl * lexp_context option
Hmm... but here I don't understand why you need this. When would you need lexp_context and wouldn't you be able to use just contet_impl (aka senv_type) instead?
Stefan _______________________________________________ Typer mailing list Typer@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/typer
-- Pierre Delaunay