[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Tue Jun 20 07:25:47 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=1094
--- Comment #205 from Dmitry Selyutin <ghostmansd at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #203)
> briefly:
>
> * sorry i am only able to pay brief attention so i saw the [] and
> assumed it had been committed.
If you intend to enter the discussion and especially use wordings like
"catastrophic", then please DO read the code and the discussion around.
> * __code__ and co_* etc. have been part of python since around 2.0.
> it's not going away, not with 25+ years of code in the world
> that would break.
Having something for 25 years does not automatically means it will be there
forever. Python developers are notorious example of breaking user examples.
They broke strings. They broke iterators. They broke a lot of code which
thought distinguishing unbound methods was a clever idea. You don't consider an
existing experience; just stubbornly repeating they won't break it won't affect
their choices at all. Again: you should not rely on this unless there are no
other options. Even if you do — prefer inspect module.
> * forcing visitors of leaf nodes to have to ignore a parameter that
> is meaningless i do not think is a good idea and i am looking for
> solutions.
You don't understand what path is. Please re-read the explanations. Leaf nodes
_have_ paths; root node _doesn't_, or, well, has it empty. Path means "how do I
get here upon walking".
But you also don't understand how the code in example works, what's even worse.
You don't read my comments, so I have to repeat it several times.
1. Walkers walk over some object recursively and yield everything they found
there. Basically walking over node, which yields subnodes, and does it
recursively.
2. When walker has something to yield from the object, it also yields what the
node that was. As if it yields string which shows paths like
"left.right.left.right". Since our nodes can have arbitrary amount of subnodes,
and can be walked differently, the paths are different too.
3. Unless you want to use this information in visitor — you don't need it. I
intentionally used a custom hook for object in my example because I _wanted_ to
pass the path to print hierarchy. And if you see how I call the visitor, you'll
see that I pass argument explicitly. But nothing forces to do it. It's walker
which emits this information, not visitor. And visitors are for installing
handlers on how to visit stuff.
> * walking down individual bits is unnecessary and if someone
> ever wanted it they should sub-class int and provide a bit-enumerator
> (__iter__). (nmigen does actually genuinely do this so it is not
> hypothetical)
You don't even read what example I bring. What's the point of this discussion
then? Again: I'm talking about situation when bits are sparsed, like in
instruction fields.
Luke, if you enter the discussion, especially with quite strong wordings,
please care to read and analyze what others already said. I'm a patient person
and can repeat several times, but I'm really concerned this became a repeating
pattern.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list