roc icon indicating copy to clipboard operation
roc copied to clipboard

Using `..` for Open Record Patterns/Destructuring

Open smores56 opened this issue 1 year ago • 2 comments

We want to start using the below syntax for open/constrained records:

{ a, b, .. } = data

and the following for closed records:

{ a, b } = data

This facilitates Roc devs being able to define closed records that will raise type errors if the destructured values get additional fields added. This is not possible in Roc today.

This change will probably break a good deal of existing Roc code that assumes that { a, b } destructures are open records, but the direction of this change precludes the ability to facilitate the transition with smart parsing + formatting.

smores56 avatar Sep 18 '24 23:09 smores56

I'll take this if you'd like!

mitulagr2 avatar Oct 13 '24 16:10 mitulagr2

@mitulagr2 great! I've assigned it to you and thrown on the "Hacktoberfest" label. Let me know here or on the Zulip if you have any questions.

smores56 avatar Oct 13 '24 21:10 smores56