Use `IsExpr` only on the front-facing Indigo functions
Clarification and motivation
In Indigo we use IsExpr
to be able to pass different things in places where we want expressions (constants, vars, expression, etc.).
We carry this constraint all over the place, from frontend to backend, however:
- this is unnecessary, we do not use the "flexibility" of
IsExpr
anywhere, we just want the front-facing functions to take different parameters instead ofExpr
- it causes a lot of messy code in case of
Expr
orStatement
manipulation, because of the necessity to extractExpr
fromIsExpr
to be able to see their content and/or replace it. This is particularly important for compilation. - it does not provide any additional type safety or restriction, because
Expr
is itself part ofIsExpr
(there have been in fact several cases of expressions/operators takingExpr
as arguments instead ofIsExpr
without raising any trouble).
In other words, IsExpr
should really only be used for the functions that get called from the frontend, but not in the backend nor be part of the data constructors, this way we'd have to call toExpr
only once (at the top of the Indigo stack of dependencies) and be able to manipulate simple Expr
everywhere else.
Acceptance criteria
Expr
is used in the backend and internal data types instead of IsExpr
.
It is important that from the outside nothing appears different, this should not concern Indigo's interface.