So I think the technical reason this happens in WebVPython is due to the way RapydScript handles keyword and non-keyword arguments. It always puts non-keyword arguments first which results in the mixup. I’d be happy to get into details off-list if you’re interested, but it’s a little arcane. Basically the first case produces this javascript:
esphere = ρσ_interpolate_kwargs.call(this, sphere, [ρσ_desugar_kwargs({pos: r, q: qc})]);
and the second results in this:
esphere = ρσ_interpolate_kwargs.call(this, sphere, [qc].concat([ρσ_desugar_kwargs({pos: r})]));
Notice that in the first case pos and q are in a separate dictionary, but in the second, pos is appended to a list with qc already inserted first.
If you try to run this in the (highly experimental) WASM version of WebVPython you get a syntax error:
Error:PythonError: Traceback (most recent call last):
File "/lib/python311.zip/_pyodide/_base.py", line 540, in eval_code_async
await CodeRunner(
^^^^^^^^^^^
File "/lib/python311.zip/_pyodide/_base.py", line 248, in __init__
self.ast = next(self._gen)
^^^^^^^^^^^^^^^
File "/lib/python311.zip/_pyodide/_base.py", line 144, in _parse_and_compile_gen
mod = compile(source, filename, mode, flags | ast.PyCF_ONLY_AST)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<exec>", line 28
esphere = sphere(pos=r, qc)
^
SyntaxError: positional argument follows keyword argument
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Glowscript Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
glowscript-use...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/glowscript-users/977952a1-2d48-41fb-9754-47bec8741527n%40googlegroups.com.