-
Notifications
You must be signed in to change notification settings - Fork 8
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
make_tool does not check type #88
Comments
Comment by @knoepfel on 2018-04-16 16:39:41 What you describe is correct. In order to provide the type-checking desired, additional constraints/prescriptions are necessary for the user to adopt. We will describe in more detail what the issues are in a future message. |
Comment by @knoepfel on 2018-04-17 14:33:30 Whenever we load libraries via our own plugin manager, it is necessary to perform a hard cast on the extern C function that creates the plugin. So when you call
It is the hard cast that erases any type safety. This has not been a problem in the past since art is usually responsible for creating the plugins, and we make sure to avoid the problem by providing the correct types. However, since There are two options we can pursue:
If you'd like to pursue option 2, then we would need to discuss this with the stakeholders to get agreement and determine priority. Please let us know. |
Comment by @dladams on 2018-04-17 15:09:28 Kyle: Thanks for working on this. Can we do both, i.e. keep the current interface so we don't break any existing code and provide a second type-safe interface? For 2 are you talking about decorating the interface header with a base class and/or macro and adding dependency on art/canvas? I find it very attractive now that it has no such dependency or decoration and would prefer a solution that avoids those. If it makes things easier, I would happily settle for a solution that only works for class tools whose interfaces have virtual methods. |
Comment by @knoepfel on 2018-04-23 16:29:13 Our preference is to provide one or the other, however we will discuss the pros and cons of either approach at the next stakeholders meeting. We are also amenable to deprecating the type-unsafe interface for a time while users get accustomed to the type-safe interface. |
This issue has been migrated from https://cdcvs.fnal.gov/redmine/issues/19674 (FNAL account required)
Originally created by @dladams on 2018-04-13 13:51:12
I find that art::make_tool(myParamSet) returns a pointer to the object described by myParamSet for any Type1, i.e. there is no type checking. This leads to undesirable behavior including crashes if the object is not really Type1.
It would be preferable for make_tool to return null or raise an exception if the object is not of type Type1.
An example may be found in dunetpc/dune/ArtSupport/test/test_make_tool.cxx.
The text was updated successfully, but these errors were encountered: