Skip to content

What declaration syntax should structs and extension structs use? #2363

Closed
@leafpetersen

Description

@leafpetersen

The proposal for structs and extension structs here uses the declaration forms:

  struct Foo(int x, int y) { 
    // members here
  }
  extension struct Bar(int x) { 
   // members here
  }

The idea of re-using the basic class syntax is fairly core to the proposal (though we could certainly incorporate pieces of this proposal into other proposals), but the choice of keywords is fairly arbitrary. The proposal lists a number of alternatives, largely around either choosing a new keyword (e.g. view, or record), or around using a modified on class (e.g. data class and view class).

This issue is for discussion of main declaration syntax. Discussion of other syntactic choices (e.g. the primary constructor syntax) should be done in a separate issue.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions