-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic classes: use cases, struct literals, struct types, and future w…
…ork (#561) This proposal defines the very basics of `class` types, primarily focused on: - use cases including: data classes, encapsulated types, inheritance with and without `virtual`, interfaces as base classes, and mixins for code reuse; - anonymous data types for called _structural data classes_ or _struct types_. Struct literals are used to initialize class values and ad-hoc parameter and return types with named components; and - future work, including the provisional syntax already in use for features that have not been decided. The intent is to both make some small incremental progress and get agreement on direction. As such it doesn't include things like nominal types, methods, access control, inheritance, etc. It proposes this struct type and literal syntax: ``` var p: {.x: Int, .y: Int} = {.x = 0, .y = 1}; ``` Note that it uses commas (`,`) between fields instead of semicolons (`;`), and no introducer for types or literal values. Incorporates decisions from #665 , #653 , #651 Co-authored-by: Geoff Romer <[email protected]> Co-authored-by: Chandler Carruth <[email protected]>
- Loading branch information
1 parent
deb1981
commit febf880
Showing
9 changed files
with
1,217 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.