Skip to content

ops.run is too ambiguous #29

@gselzer

Description

@gselzer

Let's say that you have two math.add Ops:

  1. An BiInplaceFirst<IO, I2> Op
  2. A BiFunction<IO, I2, O extends IO> Op.
    If you have the following code
IO in1 = ...
I2 in2 = ...
O out = ops.run(in1, in2);

you have no idea whether you are running the BiInplaceFirst or the BiFunction.

The solution proposed by @ctrueden is as as follows:

  • Write Functions.apply, Computers.compute, Inplaces.mutate1/2/... that provide the same functionality of ops.run (i.e. being able to pass through arguments that are used to match an Op then run that Op) however will only match their type of Op (i.e. a call to Functions.apply would only call FunctionNs).
  • Remove ops.run.

Questions:

  • How should these new methods handle transformations? I.e. if I call Functions.apply("math.add", ...), but Ops only has a Computer named math.add, what do we do?
  • There is the question of how we approach extensibility. Let's suppose that down the line a developer develops a new kind of Op that does not fit in any of these categories. Are they then restricted to calling ops.findOp? Is this sufficient?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions