This is because the $x inside the r\branch gets wrapped into a function, which it shouldn't.
I remember that there were some commands that required that behavior from nativeToDatumOrFunction, though I should re-check why it was necessary exactly.
That aside, branch as far as I know can never accept a function, so it should call nativeToDatum() and not nativeToDatumOrFunction. We should also audit other uses of nativeToDatumOrFunction.
(as another side-note, branch should also auto-convert its first argument, and furthermore we should support variadic branch)
An example for a query that currently fails:
This is because the
$x
inside ther\branch
gets wrapped into a function, which it shouldn't. I remember that there were some commands that required that behavior fromnativeToDatumOrFunction
, though I should re-check why it was necessary exactly.That aside,
branch
as far as I know can never accept a function, so it should callnativeToDatum()
and notnativeToDatumOrFunction
. We should also audit other uses ofnativeToDatumOrFunction
.(as another side-note,
branch
should also auto-convert its first argument, and furthermore we should support variadicbranch
)