roc icon indicating copy to clipboard operation
roc copied to clipboard

Using `{ a, b, ..other }` in Addition to Current &-Based Update Syntax

Open smores56 opened this issue 1 year ago • 2 comments

We currently use the following syntax for record updates:

updatedRecord = { record & foo: 123, bar: "abc" }

Which can be short-handed for a single field with record |> &foo 123.

We also want to support a different syntax:

updatedRecord = { foo: 123, bar: "abc", ..record } 

Since we have two existing syntaxes for record updates that both use the &, if we were to remove the old syntax now, we'd still have the &foo shorthand syntax. As such, we should support both syntaxes, and after looking at how the code falls out, pick a syntax based on whether we prefer the & consistency, or ..record consistency with the other ..-based changes being made in https://github.com/roc-lang/roc/issues/7091.

smores56 avatar Sep 18 '24 23:09 smores56

I'd like to give this a shot!

hrishisd avatar Oct 10 '24 15:10 hrishisd

Sounds good to me! This should help unlock some other stuff, too. I'll assign it to you and label it.

smores56 avatar Oct 10 '24 20:10 smores56