HPInc / HP-Digital-Microfluidics

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

Make quantity equality be fuzzy in macro language #211

Open EvanKirshenbaum opened 5 months ago

EvanKirshenbaum commented 5 months ago

When adding an issue about dynamic tolerances for dimensions (#210), I realized that it probably makes sense that you should be able to use it. Whether or not we need an absolute equality operator is an open question. If we do this, we will almost certainly want to make the tolerance for dimensions specifiable via interactive variables and as command-line arguments

The most straightforward way to do this would be to redefine == to call is_close_to(). If we cared, we could also add an === for the cases where you really meant equality, but that's probably not necessary.

Alternatively, we could add a new ~~ operator, but I think people are likely not to think to use it.

Finally, we could be explicit and say v1.is_close_to(v2) or v1.within(0.1 uL, v2). But that may just be long-winded. If we add prepositions (as in #139), saying v1 within 0.1 uL of v2 might not be bad for the times in which you want to specify a non-default tolerance.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Oct 26, 2022 at 11:52 AM PDT.