kdl-script
kdl-script copied to clipboard
implement positional idents
Positional idents/args/fields are written as _ (or more usually _ "MyType") and basically say "this is purely positional, I don't care about the name". I half-heartedly started on this and then got tired so the type checker will flip its shit if it hits them.
They should be supported in:
- struct fields
- if all positional fields, rust backend should emit a tuple struct (this also applies to
taggedvariant subfields) - otherwise backends should synthesize names like field0, field1, ...
- if all positional fields, rust backend should emit a tuple struct (this also applies to
- union, enum, tagged variants
- synthesize Case0, Case1
- function args
- synthesize arg0, arg1, ... and out0, out1, ...
I think there should be an enum like Named(String) | Positional(u32) for all the places this can happen, and then some convenience functions for getting a string name or checking if something should be tuply.