defining functions in object comprehensions
gurer-kensho opened this issue · comments
Gurer Ozen commented
I have encountered following corner case in one of our jsonnets:
Input:
local funcs = {
[a](x): x * 2
for a in ["f1", "f2", "f3"]
};
funcs.f1(10)
Official jsonnet output:
20
Jrsonnet output:
syntax error: expected one of "(", ".", "[", "{", "}", <binary op>, got "f"
gurer.jsonnet:3:3
One way to avoid this is to use [a]: function(x) x * 2 form which works in both implementations and a cleaner form anyway. But I'd wanted to report this just in case.