I would however be careful to use that kind of syntax.
Peeking inside a library, looking at what it converts to and using that is indeed technically an abuse of constructs. I am not sure whether it’s guaranteed that this will never change and/or will work in other drivers.
To be clear for people who read this. Normal syntax of a Let is this (this does not work due to the rebinding of ‘case’ while at the same time using it)
Let(
{
x: 1
case: null },
case: If(Equals(Var('x'), 0), 0, Var('case')),
case: If(Equals(Var('x'), 1), 1, Var('case')) ,
case: If(Equals(Var('x'), 2), 2, Var('case'))
},
Var('case')
)
This will throw an error:
However if we write a simple Let:
Let({a: 2, b: 3}, Add(Var('a'), Var('b')))
Then look at the request payload
We can see that this translates to the array syntax and in that case rebinding does work.
Let([
{ x: 0 },
{ case: null },
{ case: If(Equals(Var('x'), 0), 0, Var('case')) },
{ case: If(Equals(Var('x'), 1), 1, Var('case')) },
{ case: If(Equals(Var('x'), 2), 2, Var('case')) }
],
Var('case')
)
We should probably just allow rebinding in the original syntax instead so you do not have to do this