Unnecessary enumeration with withName

Issue #36 resolved
Ville Rantanen created an issue
object enumeration {
  val inputs=NamedMap[CSV]("inputs")
  for (i<-1 to 5){
    inputs("file"+i.toString)=INPUT(path="file")
  }
  val in_array=makeArray(inputs)

  for ((k,f)<-iterArray(in_array)) {
    withName(k) {
      val input=BashEvaluate(var1=in_array(k))
  }}
}

In this case, the in_array(k) is calling ArrayExtractor component, and the component gets a generated instance name, e.g. file5-input_var1_anduril.builtin.ArrayExtractor_5

The enumeration at the end is unnecessary, since withName decorator already takes care of unique instance name.

  • withName should be added before testing for uniqueness of name?
  • Is this trivial to correct, or too much work?
  • enumeration might trigger unnecessary re-executions at points.

Comments (2)

  1. Kristian Ovaska

    If you would access other indexes inside the withName block (like all keys 1 to k), there can be several ArrayExtractor calls. In this case they are also scoped by the input names (var1), but I don't think withName can know in general what happens inside the block. Also, ArrayExtractor doesn't know that we are inside withName.

    I think it's better to create predictably consistent names even if they are not the shortest.

  2. Log in to comment