a-mir-formality icon indicating copy to clipboard operation
a-mir-formality copied to clipboard

refactor decl grammar to be more Rust like

Open nikomatsakis opened this issue 3 years ago • 1 comments

I've been pondering the "decl layer". I think it might be a bit more readable if we made efforts to make it a touch more Rust like.

I thought we could collect ideas here in this tracking issue.

  • [x] #45
  • [x] #46
  • [ ] embed item names in the declarations
  • [ ] make Self type parameter implicit on traits
  • [ ] #21

nikomatsakis avatar May 31 '22 17:05 nikomatsakis

Some examples that came up in discussion today:

To represent static S: Foo = f-body, instead of

(StaticDecl (term (S (static () () (rigid-ty Foo ()) fn-body))))

we could do

(StaticDecl (term (static S () : (rigid-ty Foo ()) = fn-body where ())))

Note that this syntax supports generic statics/consts with where-clauses :)

nikomatsakis avatar Jun 01 '22 18:06 nikomatsakis