issa-tseng/janus

Synonyms

issa-tseng opened this issue · 1 comments

sometimes, two values are interrelated in a bidirectional fashion: some reversible function exists to transform each to the other. well—often, actually, but we tend not to bother with the synonyms much when we have to code each one up.

practical examples:

  • two representations of time: framecount vs seconds
  • index <-> single element of a discrete space

in many of these cases, it would be nice if rather than being forced to choose a primary and a bound derivative, the bidirectional relationship could be expressed, and the singular nature of the underlying value can be reasoned about directly. then, questions around reading or writing to the value as seen by the representations shed all these artificial translations and limitations.

almost forgot: smart people call these bijections.