kdl-script icon indicating copy to clipboard operation
kdl-script copied to clipboard

implement positional idents

Open Gankra opened this issue 3 years ago • 0 comments

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 tagged variant subfields)
    • otherwise backends should synthesize names like field0, field1, ...
  • 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.

Gankra avatar Oct 15 '22 22:10 Gankra