The current implementation seems brittle. Is there a better overall approach? Alternatively, we could try to strengthen the current version.
At a minimum, reduce the use of self._file._load_fn, etc. from foreach and generally, clean-up how sub-nodes are created. Also, clean-up the create_node decorator code for ComputeNode vs ForeachComputeNode.
Can we make the sub-nodes that are created inside a ForeachComputeNode more visible (e.g. through node.text_graph() esp. before running evaluate).
Can we support multiple foreach variables?
Can we provide a better interface for foreach than string/position?
Can we make the ForeachComputeNode dep have a different name than the foreach var name (e.g. foreach="years", but deps=["year"] -- not deps=["years"]). This should create more interpretable names for deps (since the function only acts on each individual "year", not all "years").
The current implementation seems brittle. Is there a better overall approach? Alternatively, we could try to strengthen the current version.
At a minimum, reduce the use of self._file._load_fn, etc. from foreach and generally, clean-up how sub-nodes are created. Also, clean-up the create_node decorator code for ComputeNode vs ForeachComputeNode.