roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.47k stars 314 forks source link

Using `{ a, b, .. } as data` Instead of `{ a, b, ..rest }` for Full Record Captures #7096

Open smores56 opened 2 months ago

smores56 commented 2 months ago

As much as using { a, b, ..rest } as a way to capture the entirety of an open/constrained record would be obvious syntax based on the changes suggested in https://github.com/roc-lang/roc/issues/7094, it implies that we would remove the a and b fields from rest, which as seen in Elm's development, would be an unperformant and messy feature to support. As such, we should just use the as data capture syntax on an open record to capture all fields.

Aditya-PS-05 commented 1 month ago

@smores56 I am interested in solving this issue but want to do it under Hacktoberfest label. Can you please add hacktoberfest label and assign it to me.

Aditya-PS-05 commented 1 month ago

@lukewilliamboswell , I am having some issues in finding the exact location of this functionality. Can you help by telling the appropriate location to look for it.

Is this is the location of this functionality? https://github.com/roc-lang/roc/blob/72011fba7387a6d8346ea5d8befdb00b90ecb5b6/crates/compiler/can/src/expr.rs#L1508

lukewilliamboswell commented 1 month ago

I'm not familiar with this part of our codebase. I'm hoping @smores56 or someone else could help you with this.

Anton-4 commented 1 month ago

I was surprised to find that { a, b, ..rest } is not currently supported, if I re-read the original issue this is clear. Knowing that, perhaps this is too complicated for a good first issue @smores56?

smores56 commented 1 month ago

Actually, this one will need to wait for https://github.com/roc-lang/roc/issues/7097 to be implemented first. It's (presumably) an easy issue once that issue gets finished. @Aditya-PS-05 you should do something else first. Let me know if you need help selecting an issue!