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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jun 18 18:19:46 BST 2023


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

--- Comment #154 from Dmitry Selyutin <ghostmansd at gmail.com> ---
Hm. Luke, I re-read your comment, and I think I now understand what you mean.
You likely mean that we can detect the dataclasses.dataclass function itself...
Yes, I think this can be arranged, perhaps just via dataclasses.isdataclass
instead. I'm a bit concerned that this kinda contradicts to the other code —
passing classes and iterating over MRO. But I'll check whether these two
options can coexist in a graceful way. Perhaps we can have a fork at
isinstance(thing, type) and is callable(thing). I'll check it, I like that it
allows some flexibility.

What I mean is:

@dispatcher.Hook(dataclasses.isdataclass)
def dispatch_dataclass(...): whatever()

If the Hook is capable to handle callables, that'd work too. Just not
dataclasses.dataclass, because this one just wraps the class and I'd like to
the code to be somewhat generic and not tied to special constructs (except for
builtins perhaps; these are fine).

I'll investigate the ideas with callables. I think it's doable.

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


More information about the libre-soc-bugs mailing list