sofa
sofa copied to clipboard
[Sofa.Core] Implements a template deduction system in the object factory
Currently canCreate is used for several things, one of the most common use is to implement template type deduction.
On this PR we implement a mechanism that will allow to separate the type deduction to actual possibilities of creation of the component.
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if
- it builds with SUCCESS for all platforms on the CI.
- it does not generate new warnings.
- it does not generate new unit test failures.
- it does not generate new scene test failures.
- it does not break API compatibility.
- it is more than 1 week old (or has fast-merge label).
So, if I understand correctly, you implemented 2 methods to deduce the template: 1) a static method in the component, 2) an additional line when registering in the object factory.
Yes, despite it is possible to have only the system with the static method I find the explict method more clear despite it does not allow to cover the same set of feature. We may remove it if needed.
[ci-build][with-scene-tests]
@alxbilger do you want me to remove the approach based on explicit registration so that there is only one single way of doing that ?
Do you consider that this PR supersedes https://github.com/sofa-framework/sofa/pull/3309 ?
You mean in term of what priority for merging ?
I mean they both solve the same problem using different approaches, right?
Not exactly, the first is about refactoring canCreate and create while the other is about providing a system for template deduction. It seems connected because canCreate is widely used to implement template deduction (but it is not its sole purpose). If template deduction is merged this will remove a lot of canCreate... but some may still. So some ideas in #3309 may still have values independently of #3938.
[ci-build][with-all-tests]
@hugtalbot do we move forward on that one ?
@bakpaul as you set it to wip can you elaborate what should be done.
@damienmarchal yes, we should schedule a discussion between you, alex, us (Hugo and/or me) and anyone interested, but outside the sofa dev meeting to come to a solution.
Thank for the answer...can you explain a solution to which problem ?
To the related discussions (#3938, #3987 & #3990). This is a big subject and it has been concluded that it would require more direct discussions to come to a agreement.
I set it back to review... otherwise we forgot to discuss about it at code review.
We had a meeting planed to discuss this along with @bakpaul @alxbilger but your did not show up @damienmarchal I think we should discuss it as planed separately from the SOFA dev meeting:
- #2712
- #3938
- #3987
- #3990
I may also add two related old pr to the list, they are on the refactoring of create and canCreate methods :
- #3309
- #3311