[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sat Jun 10 15:13:31 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1094

--- Comment #98 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Dmitry Selyutin from comment #91)
> Luke, you again contradict to your own words. Please *re-read* what you
> wrote before. Passing *visitors* is not part of walking.

that was me trying to say "when the visitor function was itself
performing the walk" rather than it being the separate function
it is now (not very well but we got there)

a "well-defined collaboration with default behaviour" between Visitor
and walker-function (def visit()) is perfectly fine.... but... ha!
don't need it!

love this:

    @visitor(StubVisitor, str)
    def coco(self, node):
        print("BY GOD IT'S A STRING!!!", node)
        yield node

oo does that.... oo it separates the thing from the thing, oooo.
does this work?

    class StubVisitor(Visitor):
        def __init__(self):
             self.stuff = "something"
        @visitor(StubVisitor, str)
        def coco(self, node):
            print(self.stuff, "BY GOD IT'S A STRING!!!", node)
            yield node

can this be made to work without needing the 1st argument?
        @visitor(str)

registry as a global variable will break things, it needs to be
part of Visitor itself?

class Visitor:
     registry = defaultdict()
     def visitor(cls, nodecls):
          registry(....)

but for inheritance, sigh, the registry dict should be separate?
ohhhh you made it double-nested, a dict-of-dicts, niiice

more later, need food.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list