Files
carbon-lang/proposals
josh11bandChandler Carruth 0820dec01f Nominal classes and methods (#722)
Add support for nominal (or "named") classes with encapsulation. Inheritance will be in a later proposal. Here is an example of the proposed syntax:

```
class Circle {
  fn Create(c: Point, r: f32) -> Self {
    return {.center = c, .radius = r};
  }
  fn Diameter[me: Self]() -> f32 {
    return me.radius * 2;
  }
  fn Expand[addr me: Self*](distance: f32);

  private var center: Point;
  private var radius: f32;
}

fn Circle.Expand[addr me: Self*](distance: f32) {
  me->radius += distance;
}
```

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2021-08-23 15:45:41 -07:00
..
2021-04-23 17:19:23 -07:00
2021-04-23 17:19:23 -07:00
2021-04-21 13:00:03 -07:00
2021-04-21 10:06:44 -07:00
2021-05-14 15:38:45 -07:00
2021-05-07 14:27:21 -07:00
2021-04-13 20:57:17 -07:00
2021-05-10 16:42:01 -07:00
2021-06-29 10:52:45 -07:00
2021-07-02 14:54:59 -07:00
2021-08-10 20:46:23 -07:00
2021-07-08 10:39:36 -07:00
2021-07-09 11:49:32 -07:00
2021-07-22 10:42:54 -07:00
2021-08-04 14:27:11 -07:00
2021-08-03 15:37:18 -07:00
2021-08-23 15:45:41 -07:00
2021-08-23 15:45:41 -07:00

Proposals

This directory contains accepted proposals for the carbon-lang repository. For information about declined/deferred proposals, please view the proposal's original pull request.

For accepted proposals, where #### is the corresponding proposal's pull request:

  • p####.md will contain the main proposal text.
  • p#### may be present as an optional subdirectory for related files (for example, images).

Proposal list