[Libre-soc-bugs] [Bug 838] sync or at least statically check fields.text, power_decoder, trans/svp64, CSVs between each other
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Sat Aug 6 04:07:07 BST 2022
https://bugs.libre-soc.org/show_bug.cgi?id=838
--- Comment #22 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/power_insn.py;hb=9dbf16f3aa783d95ca92ad74ebef9474c7750dd2#l122
ah, sorry, just saw this - can you please try to find another way that
does not use dataclasses. the reason is not just that they restrict
types but that i am endeavouring to ensure that jacob begins to respect
python as a dynamic runtime language based around the Liskov Substitution
Principle. dataclasses, by being like structs of other languages,
make a mockery of that strength of LSP.
a good alternative would be to turn that list of name-types into a
dictionary and then use setattr()
again, here:
313 class Instruction:
314 section: Section
315 ppc: PPCRecord
316 svp64: SVP64Record
317 rc: bool = False
please do find another way to do that which does not use dataclass.
i do not want us to have to spend the money explaining to a team
of *HDL* engineers not used to advanced python programming what the
hell dataclasses are.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list