philbull / cosmoparams

Specification for a base cosmological parameter class
MIT License
2 stars 0 forks source link

clarify the role (API) of this repo in different use cases #2

Open yymao opened 6 years ago

yymao commented 6 years ago

@philbull I move the discussion here so we can be more focused without jamming the tjp channel.

I think we are on the right track here already, but I want to further distinguish different use cases and what (in my opinion) this repo's rule would be.

I think there are 3 different use cases:

Here, (C) is really just the combination of a subset of (A) and a subset of (B). However, by splitting (C) from (A) and (B), we can enforce the specification with code. In other words, instead of just asking people who writes (A) and (B) to conform to the specification, we can use (C) to make sure they do conform to the specification.

So, I think what we want to do is to implement is (C) (in both C and Python), and by doing so, we would have automatically fully specified our specification.

Here's an some examples (in Python only) of this imaginary (C) module which I call desccosmo

As always, comments are welcome. And thanks to @philbull again for taking a lead on this!

philbull commented 6 years ago

Yes, I agree that having a standalone validation function (C) will be the best way of testing compliance with the standard. I think we can provide reference implementations and a standalone validation function at the same time in this repo.

yymao commented 6 years ago

Sure. I think my earlier confusion came from that I thought that SPECIFICATION was written for who's working on (A) and (B). If SPECIFICATION is intended to instruct who will implement (C) then it makes perfect sense.

The hash function you just added in the specification and also be a function in this module (in my example above it would look like desccosmo.hash(cosmo)).

philbull commented 6 years ago

I think the specification should still be useful to people implementing their own class (case A). I guess you could think of it as the "documentation" of code (C). People doing (B) don't need to worry about it, but people writing their own implementations do need to follow the spec.

yymao commented 6 years ago

Yep, sure.