HPInc / HP-Digital-Microfluidics

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

Injectable `set` expressions in DML #295

Open EvanKirshenbaum opened 5 months ago

EvanKirshenbaum commented 5 months ago

Thinking about paths some more (#282), one of the things you often want to do is assert a new reagent for the drop, either waste or something protocol-specific. The most straightforward way to do this is probably something like

... : set reagent = waste : ...

(or to waste).

This would be essentially equivalent to

... : lambda(drop d) { d's reagent=waste; } : ...

or possibly better

... : (lambda(drop d, reagent r) { d's reagent=r; })(waste) : ...

except that when the compile sees set reagent = waste, it can't know that what it's going to need is a drop. So what I probably want is a result that can take anything that has a reagent attributethat could takewaste`.

In other words, set A to E evaluates E and returns a lambda that can take anything that has an A that can be set using E's type. To do this right, I will definitely need overloaded functions (#288).

One thing to note here is that I want to get the precedence right so that set expressions can sit within injection chains. That is,

... : set attr to x+1 : ...

should put the addition within the value, but

... : set attr to x : f : ...

should take f as the next injection target. To make it part of the value, you should have to say

... : set attr to (x : f) : ...
Migrated from internal repository. Originally created by @EvanKirshenbaum on Aug 03, 2023 at 11:43 AM PDT.