strangemonad / runway

Domain models and their values
1 stars 0 forks source link

Explore how models map to cannonical target language types #5

Open strangemonad opened 7 years ago

strangemonad commented 7 years ago

Multiple dimensions to explore here

e.g. we want to model an Instant type and some other type that has an Instant (e.g. Person.createdAt:Instant)

various design dimensions / options

1) use the generated model and have a toNativeInstant() converter. This is cumbersome and unnatural for someone doing domain objects. We really just want to be able to do person.createdAt().isAfter(instant) 2) Use the native type in the generated Person class. This is somewhat like a type alias but really more of type equivalence up to an isomorphism in representational accuracy (see #10 #11 #12 #13 #14, #16). In this case, the definition of Instant somehow has a semantic interpretation (the set of representable values captures the range of smallest to largest instant and also the granularity). Not all types are representable by concrete / countable sets (some are recursively innumerable). This would mean that we would have a similar semantic definition of the equivalent target type e.g. java.time.Instant (or we keep the proof at a meta level). 3) A simple type alias doesn't solve for cases where a serialization format is needed or where a target language doesn't have a canonical representation 4) capture the homotopy / homotopy equivalence between paths / transport? Maybe identity types from DTT / ITT are enough?

strangemonad commented 6 years ago

This might need to be considered in tandem with #24