roc-lang / roc

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

Glue for Roc tuples #3134

Open rtfeldman opened 2 years ago

rtfeldman commented 2 years ago

Right now when bindgen generates Rust structs, it assumes that all Roc field names are valid Rust struct field names. This will change when we have tuples, as they can have field names like 1, 2, etc.

We can theoretically prefix these on the Rust side with a letter, e.g. 1 becomes f1, but if we do that, we need to be careful of collisions; it's possible (although extremely unlikely in practice) in Roc to have a record with both a field named 1 and also a field named f1.

joshuawarner32 commented 1 year ago

Why not just generate rust tuples?