-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External ufl types. #127
Comments
Hi Rob, This is actually a disgusting design flaw in UFL. It has its own type system layered on top of the Python one. I think this was done because at the time Python didn't have singledispatch. The effect of this is that it's essentially impossible to add UFL types outside of ufl itself, for exactly the reason you have noticed. I think the correct answer is actually to get rid of the extra type system completely. We have funding to essentially rethink UFL and plan to do this, but it's going to take some time. |
Hi David, thanks for the quick answer. I was just wondering if in this particular case a quick fix could be implemented that updates the internal lists. It seems like the class variables in Line 215 in 4e3868d
|
This will be fixed once we've removed the internal UFL type system |
When adding an UFL type using the
@ufl_type
decorator this seems to lead to errors in, for example, theTransformer
class fromufl.algorithms
. Example, somewhere in some external (to ufl) code:This leads to an index error in
ufl/ufl/algorithms/transformer.py
Line 89 in 4e3868d
all_ufl_classes
:However, this can cause problems when other Python modules using UFL are included before these two lines, because it can mess up the index order in
all_ufl_classes
. So the result is, that all other modules using UFL should be included after this statement.So the question is: What is the correct way of adding external UFL types (besides using
@ufl_type
)? Or is this a bug and the modification of the UFL internal lists and sets should be done inside the@ufl_type
functions?The text was updated successfully, but these errors were encountered: