I think we should remove the field operator, because, as @lasarojc found out, its type signature is a lie:
>>> val r = {a: 2}
>>> val f = "a"
>>> r.field(f)
static analysis error: error: [QNT000] Record field name must be a string expression but is name: f
Generating record constraints for r,f
Generating constraints for f
r.field(f)
^^^^^^^^^^
2
either f doesn't have type string, or the type signature for field is incorrect.
For the same reason, we should replace with with an update syntax that doesn't pretend to take strings :)
E.g., {r with a : 42}.
We could introduce the ability to pass around labels, perhaps indexed by union types, around. But this would be significantly more involved.
I think we should remove the
fieldoperator, because, as @lasarojc found out, its type signature is a lie:either
fdoesn't have typestring, or the type signature forfieldis incorrect.For the same reason, we should replace
withwith an update syntax that doesn't pretend to take strings :)E.g.,
{r with a : 42}.We could introduce the ability to pass around labels, perhaps indexed by union types, around. But this would be significantly more involved.