Description
A Reactor
may issue CellID
s in response to either a create_input
or create_compute
.
A Reactor
accepts CellID
s in the following circumstances:
create_compute
so that the caller specifies the dependencies of the compute cell to be created. These dependencies may be either input or compute cells.value
. May be either input or compute cell.set_value
. Only valid for an input cell.add_callback
/remove_callback
. Only valid for a compute cell. There is no technical barrier against an input cell having callbacks, but the specification does not call for it and it is never tested.
I believe it is technically feasible to have slightly more safety, as follows:
create_input
issues onlyInputCellID
s.create_compute
issues onlyComputeCellID
sadd_callback
/remove_callback
acceptComputeCellID
only.set_value
acceptsInputCellID
only.create_compute
andvalue
need to acceptenum CellID { Input(InputCellID), Compute(ComputeCellID) }
Should this be done? Is this a reasonable API and/or any other reasons it's a good/bad idea?
If we do this, is it further possible to test at compile-time that InputCellID
and ComputeCellID
cannot be assigned to each other? Even if it is possible, should we do that? I encourage making them unassignable to each other for more safety, but I don't want students to feel too restricted.
If I do not hear objections or think of any myself, I will investigate what the code looks like. I will not be offended if there were initially no objections but objections come to light after the seeing the code.