Closed nsbgn closed 2 years ago
While type inference works inside tools, between tools, the types are fixed to their most general. This is because each tool expression is evaluated before being concatenated.
That is, say that we have a function f : x ** x | x << Ratio
and a tool T that implements that function. We then write the algebra expression for T as f(~Ratio)
. But this means that T has a function signature of Ratio ** Ratio
, NOT of x ** x | x << Ratio
. This works perfectly fine when attaching the output of tools to input of other tools, because this is indeed the most general instance of T
--- but we lose the specificity on the output end.
This can be considered a bug.
Labelled sources should not be represented as Python data structures. Instead, labels are directly substituted with expressions during the parsing stage. If it is desirable to have substitutable structures in an evaluated expression, then variables in abstractions are a better way to achieve that.
Labels that refer to source nodes would simply be replaced with the corresponding source expression (eg ~A).
We have been working with objects of type dict[Expr, list[Node | Expr]]
to represent workflows. However, when issue #72 is resolved, we can no longer simply map Expr
objects to their inputs, as Expr
can only be parsed once the inputs are parsed. Therefore, we should make a dedicated Workflow data structure for use in TransformationGraph.add_workflow
. This will require a lot of changes in the tests.
~If this is to work, sources should probably know their most specific type. Otherwise, an expression like f (1: A)
would need the actual type of 1 to remain variable, since it might also be 1.~ Actually, we can just keep it variable, and at the point that we are generating a graph, assume that type inference has run its course and set the type to be the most general possible (i.e. A
).
The NoisePortionAmsterdam and Deforestation scenarios from https://github.com/quangis/cct seem to have some operation nodes that have a type that is hard to explain.
NoisePortionAmsterdam: an instance of
getamounts
isR2(Reg, Ratio)
, but should be R2(Reg, Count). Why?Deforestation: an instance of
subset
isR2(Loc, Nom)
, but should beR2(Loc, Bool)
. Why?