Skip to content
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

StandardUnits live in Units, but prefixes in enumerations.h #204

Open
MichaelClerx opened this issue Sep 26, 2017 · 5 comments
Open

StandardUnits live in Units, but prefixes in enumerations.h #204

MichaelClerx opened this issue Sep 26, 2017 · 5 comments
Labels
New feature Additional feature

Comments

@MichaelClerx
Copy link
Contributor

Hi all!

What's the rationale for this?

(Another example is InterfaceType, which lives inside Variable

@agarny
Copy link
Contributor

agarny commented Sep 26, 2017

Fair point. @hsorby, @dladd?

@MichaelClerx
Copy link
Contributor Author

MichaelClerx commented Sep 26, 2017

SpecificationRule lives in its own file, specificationrules.h

(should be specificationrule.h for consistency, but preferably shouldn't be a separate file at all!)

@dladd
Copy link
Contributor

dladd commented Sep 27, 2017

Good catch- I think this may be a case of legacy inconsistencies that stick out now that things are better fleshed out. Although I have a vague memory of someone pointing out that there may be use-cases for SI prefixes outside of the context of units (maybe @hsorby?). That aside, my original preference was to hierarchically specify when possible- for example I prefer the StandardUnit vs. the Prefix specification below:

u->addUnit(libcellml::Units::StandardUnit::AMPERE, libcellml::Prefix::MICRO);

@MichaelClerx , it sounds like you prefer bringing all the enums into enumerations.h? Would a flatter structure for these make things more straightforward for the bindings? I'd agree that consistency is the more important consideration here.

@MichaelClerx
Copy link
Contributor Author

@dladd For Python bindings it would be easiest if the enums were all defined constants instead (but this means you lose some type-safety on the C++ side I think)!

Organisation-wise, I don't like the "enumerations" file because it's hard for the user to guess which enumerations are and are not inside it. So I'd much prefer if Prefix, Format, and SpecificationRule either (1) Each lived in their own private header file, or (2) Were all part of some suitable class

@hsorby
Copy link
Contributor

hsorby commented Sep 28, 2017

I would prefer to have all enumerations that aren't attached to a class to have either there own header file or live in the class header they are used by. For example the InterfaceType is only for variables and must be part of the class. Whilst the Prefix and StandardUnit are associated with the Units class as concerns libCellML I could make a case for; separate headers; in the class header but not the class declaration; in the class declaration. It just depends on which object model philosophy we choose to follow. I think as it stands we aren't following a single object model philosophy.

For me with regards to the bindings I think we would be better off bringing the prefix enumerations into the units class and saying as far as the libCellML object model is concerned prefixes and standard units are part of Units. I hope @nickerso has something to say if prefixes or standard units can be used outside of Units in the libCellML domain.

@MichaelClerx MichaelClerx added the New feature Additional feature label Aug 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New feature Additional feature
Projects
None yet
Development

No branches or pull requests

4 participants