You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That said, going back to our first example, the field name cast would only make sense if the user knows the implementation detail of float64() being a wrapper around the cast() function. Instead one of the following would seem more intuitive:
Using the field name float64 to match the behavior we just saw with abs().
Maintaining the original field name (y in this case).
In a group discussion, there was consensus on maintaining the original field name, which happens to match my instincts as well.
In that same discussion, @mattnibs pointed out a related surprise that when dealing with nested fields, this casting operation creates a top-level field, whereas he's felt it should keep the value in its nested path location.
tl;dr
As a user, the field name
cast
seems unexpected here.Details
Repro is with Zed commit b8fe312.
In the language, field names are commonly derived from function names when the calls are made in record expressions like this. For instance:
And of course, if a user wants to explicitly assign a field name to avoid this effect, they can include explicit assignment.
That said, going back to our first example, the field name
cast
would only make sense if the user knows the implementation detail offloat64()
being a wrapper around thecast()
function. Instead one of the following would seem more intuitive:float64
to match the behavior we just saw withabs()
.y
in this case).In a group discussion, there was consensus on maintaining the original field name, which happens to match my instincts as well.
In that same discussion, @mattnibs pointed out a related surprise that when dealing with nested fields, this casting operation creates a top-level field, whereas he's felt it should keep the value in its nested path location.
If we don't address that when taking up this issue, I can open a separate issue at that time.
The text was updated successfully, but these errors were encountered: