Closed alexfanqi closed 8 months ago
Testing was done by first testing new serialization against old deserialization, then testing new {de,}serializations together.
Thank you for the addition! It looks great, but there is one test that's failing because you're using a "|" for a type annotation. Swapping that with Union should do the trick. I'm also happy to push the change, if you prefer :)
Thank you for seeing this through @alexfanqi :partying_face:
Closes #55
Hi,
Since it seems no one is working on #55, I took the liberty to fix it. If this happens to be a few hours faster than anyone's work :-P, I am happy to withdraw or discuss for a better implementation.
Deserialization requires a reflection registry to create class from string. I choose to explicitly list all serialisable NIRNodes in a static ir.__all_ir because it is simple and there seems to be no demand for user-defined NIRNode out of the repo.
Another option would be using
metaclass
/__init_subclass__
to dynamically register new sub classes in NIRNode. But I feel__init_subclass
is black magic.Would love any feedback for new file structure and implementation.
Cheers