Laziness of std.filter

71 views
Skip to first unread message

Stefan Zeiger

unread,
May 18, 2021, 2:24:22 PM5/18/21
to Jsonnet
Hi,

I'm trying to understand how much lazy evaluation is allowed to be but the spec isn't clear on this. Since there is no mention of evaluation order for the operational semantics I'm assuming that arbitrary reductions are allowed. This doesn't help with native functions like std.filter though. Take this program:

    std.filter(function(x) x == 1, [1, std.assertEqual(1,2)])[0]

This fails with "RUNTIME ERROR: Assertion failed. 1 != 2" in the standard jsonnet interpreter. Is it required to fail? Or can the interpreter skip evaluation of array elements that are not required for the result?
Reply all
Reply to author
Forward
0 new messages