Stream: compiler development

Topic: Record destructure declarations


view this post on Zulip JRI98 (Jul 16 2025 at 20:59):

Hello. I'm working on implementing the parsing of record destructure declarations.

{ name, age, email } = person

Am I missing something or can I assume that in case of an open curly at the beginning of a statement, the only possibility is for it to be a record destructure declaration? Could it in any way be a block?

view this post on Zulip Anthony Bullard (Jul 16 2025 at 21:00):

Yes this is fraught and i am currently addressing this in my open PR. i've been on vacation but plan to finish it up starting tomorrow

view this post on Zulip Anthony Bullard (Jul 16 2025 at 21:00):

https://github.com/roc-lang/roc/issues/7897

view this post on Zulip JRI98 (Jul 16 2025 at 21:01):

I am just experimenting with it. I can drop it if it interferes with what you are doing. But it got me thinking about this

view this post on Zulip Anthony Bullard (Jul 16 2025 at 21:02):

tldr we need to have an untyped node type and be able to parse these ambiguous tokens and be able to recover seamlessly without backtracking or reparsing

view this post on Zulip Anthony Bullard (Jul 16 2025 at 21:03):

You can feel free to look at my PR or propose a different approach. This should have been done already but my vacation ended up being more busy than my normal working days

view this post on Zulip Anthony Bullard (Jul 16 2025 at 21:03):

Speaking of which, my flight is about to take off. I'll check in tomorrow morning!

view this post on Zulip JRI98 (Jul 16 2025 at 21:03):

Thank you. Have a safe flight :airplane_departure:

view this post on Zulip JRI98 (Jul 16 2025 at 21:07):

In the meantime I will publish my proposal as a draft. I don't really like it because it has to look ahead (ugh) but it kinda works

view this post on Zulip JRI98 (Jul 16 2025 at 22:23):

After a bit of tinkering, here it is https://github.com/roc-lang/roc/pull/8061


Last updated: Jul 26 2025 at 12:14 UTC