Allow compilation of arbitrary values from files
Currently I can compile values, lambdas, etc. using something like ligo compile-expression cameligo "fun (a : nat) -> a + a"
. However this doesn't seem to work in more complex scenarios because #include
is not supported in this context.
If I have a file called MyFile.mligo
#include "MoreDefinitions.mligo"
let myValue = fun (a : nat) -> a + a
And try to compile myValue with
ligo compile-expression cameligo "
#include \"MyFile.mligo\"
myValue
"
It attempts to compile, but the compiler is trying to evaluate the whole input as a value and fails.
It would be helpful if I could write something like ligo compile-expression MyFile.mligo myValue
(similarly to evaluate-value
).
Some use cases for this:
- gas optimization scenarios involving storing lambdas in big_maps (compiling arbitrary lambdas would be possible)
- admin entrypoint accepting arbitrary lambdas for execution (again, I could write my admin lambdas in Ligo)
- TZIP-16 is proposing off-chain Michelson views - off-chain views could be written using Ligo
Edited by Miroslav Bodecek