-
-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add postfix record update syntax #7226
base: main
Are you sure you want to change the base?
Conversation
#[derive(Clone, Copy, Debug, PartialEq, Eq)] | ||
pub enum RecordUpdateKind { | ||
/// e.g. `{ oldRecord & field: newValue }` | ||
Prefix, | ||
/// e.g. `{ field: newValue, ..oldRecord }` | ||
Postfix, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of naming these DeprecatedAmpersand
and NewDotSpread
?
I assume the intention is to deprecate the older syntax and eventually remove, so long term these wont be required but until then it's clearer I think what they are doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can definitely clarify the naming! I'll just double-check that the intention is indeed to deprecate the older syntax. My previous impression was that the dot spread syntax was experimental.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say that it's experimental in the way that most stuff in Roc is experimental. We want to unify the aesthetic of our syntax by moving types where appropriate to the new ..
syntax suite, but we may throw all of it away in the future like we did with Task
and camelCase and applicative record builders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we don't call all of this stuff experimental, we just assume it'll be in the compiler for the time being until we remove it. The only stuff that we tend to name based on how short-lived it is would be stuff we plan to deprecate soon, like the old record builder syntax (that has since been removed), or maybe Task stuff.
So I'd just call it DeprecatedAmpersand
and DotSpread
myself.
Sorry for the delay - just want to make some improvements that were suggested in Zulip, which is taking some time. Marked as draft for now. |
Adds an alternate post-fix syntax for record updates
Closes #7097