Just a few drunken thoughts to consider...

Date: 2008-05-05 01:27 (UTC)
I'd suggest that it might be worth reconsidering the structure of the code that the zipper is over (to the extent you can control this). It seems more natural to me to formulate "up" and "down" as entering and exiting block-scope entities (such as `def` blocks, `method` blocks, etc) and to have "left" and "right" cover the issue of ranging through statements within a block. The notion of environment is somewhat complicated by this (leftward in-block + upward) since you have a "tilted" tree instead of a regular tree, but it captures scoping issues more accurately.

So checking the foo, from the usage site we check to the left (nothing there), then we move up through b, and check to the left (nothing there), then move up through bar,... until we hit the definition of foo. Depending on how you've implemented your zipper you could either do this lookup scan each time, or maintain an auxilliary structure that tracks the current environment in order to jump back quickly (e.g. using a backtracking (http://okmij.org/ftp/Computation/monads.html#LogicT) monad), or your zipper could be set up with some sort of CPS which combines those two approaches (i.e. the backtracking monad is your encoding of the left/up-ward closure of the environment).
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org