[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Mon Jun 19 20:00:15 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=1094
--- Comment #182 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #180)
> {3: A(5, [12, 3])} path=[]
>
> no that is not okay (path=[]). ints do not have and do not need paths.
you misunderstood this: path is the list of all indexes/keys/field-names needed
to get from the root object to the current value, here, we're visiting the root
object (not an int, it's a dict) so obviously no indexes/keys need to accessed
to get from the root object to the root object, hence why path=[].
and, yes, ints *need* paths, so you can tell which int you're referring to, the
path is not some intrinsic property of the int, but instead tells you how to
get to the int from the root object. this is important for things like e.g.
SelectableInt(123, 45) (or csv row dicts), where it will visit both the 123 and
the 45 and the path is *essential* to not confuse bit-width with value.
>
> there are two solutions i can think of:
>
> 1) instance, *args - and for non-iterables *args would be empty
> 2) always yield a (new) "Instance" object, which contains a
> mandatory "instance" and an **OPTIONAL** index (which you
> call "path" jacob)
no, path is the full list of indexes/keys/field-names needed to get from the
root object to the current value. it is important that nothing is skipped in
the path, so you don't get 2 different values with the same path and can't
easily distinguish which one does what, hence why it includes dict/set keys
when visiting some entry in the dict/set and field names when visiting a python
class.
note that the same list can have items pushed/popped from the end -- treating
it as a stack, so visiting stuff doesn't need to allocate a new list every
function call
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list