Skip to content

Conversation

schnellerhase
Copy link
Contributor

@schnellerhase schnellerhase commented Aug 11, 2025

Removes the runtime generated class hierarchy in favour of explicitly inheriting form UFLType. All information is propagated through the class hierarchy inheriting from UFLType and thus follows standard Python rules. This removes the need for 'checking the type system' and opens the expression hierarchy up for further changes and upgrades.

The decorator ufl_type now only sets the properties _ufl_typecode_ and _ufl_handler_name_, but no more of other 'traits'. These two options are somewhat special and are required to exist prior to any UFLType instantiation (so __new__ is not usable for those). This should probably be addressed at a later stage to remove the @ufl_type completely.

Global class tracking and profiling information is moved from the UFLType base class to the new UFLRegistry, which for now maintains both (classes and profiling). This can also be further refined in the future.

First (big) step to resolving #127: Introduces a test case showcasing how external types now fit into the UFL abstractions and can be handled with the same transformations.

@schnellerhase schnellerhase marked this pull request as ready for review August 12, 2025 20:12
Copy link
Member

@mscroggs mscroggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll review this thoroughly at some point but looks like excellent progress towards cleaning up the type system

Base automatically changed from schnellerhase/fix_386 to main August 21, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants