HPInc / HP-Digital-Microfluidics

HP Digital Microfluidics Software Platform and Libraries
MIT License
2 stars 0 forks source link

Rework type conversions in macro language #222

Closed EvanKirshenbaum closed 5 months ago

EvanKirshenbaum commented 5 months ago

While trying to implement prompt (#219), and reworking the injection logic, it became clear that the type conversion scheme is in drastic need of an overhaul.

In particular, it would be nice if

  1. I could just find the widest functional type for a (potentially non-functional) type such as DIR or ON, so that I didn't need to have special cases everywhere.
  2. CallableValue should be able to provide a wrapper value to take the types it is provided and do conversions on input and output automatically.
  3. CallableValue should do proper narrowing (covariant param types, contravariant return types)
  4. Representation types should be stored with the types.
  5. Conversion functions should be transitive when registered and implicitly inferred based on representation.
  6. Conversion functions should be cached with the source type to prevent all the expensive logic.
    Migrated from internal repository. Originally created by @EvanKirshenbaum on Jan 24, 2023 at 12:02 PM PST. Closed on Jan 26, 2023 at 5:38 PM PST.
EvanKirshenbaum commented 5 months ago

This issue was referenced by the following commits before migration:

EvanKirshenbaum commented 5 months ago

Everything's all nice and refactored, though not tremendously well tested.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Jan 26, 2023 at 4:59 PM PST.