Skip to content

Commit

Permalink
Decision for p0143 - Numeric literals (#167)
Browse files Browse the repository at this point in the history
Adds a decision and rationale for proposal #143.

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
  • Loading branch information
chandlerc and jonmeow authored Oct 16, 2020
1 parent 4e81e25 commit 3bd756c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions proposals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ request:
- [0120 - Add idiomatic code performance and developer-facing docs to goals](p0120.md)
- [Decision](p0120_decision.md)
- [0143 - Numeric literals](p0143.md)
- [Decision](p0143_decision.md)
- [0149 - Change documentation style guide](p0149.md)

<!-- endproposals -->
63 changes: 63 additions & 0 deletions proposals/p0143_decision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Decision for: Numeric literals

<!--
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
Exceptions. See /LICENSE for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-->

Proposal accepted on 2020-09-15

Affirming:

- [austern](https://github.com/austern)
- [chandlerc](https://github.com/chandlerc)
- [geoffromer](https://github.com/geoffromer)
- [gribozavr](https://github.com/gribozavr)
- [josh11b](https://github.com/josh11b)
- [zygoloid](https://github.com/zygoloid)

Abstaining:

- [noncombatant](https://github.com/noncombatant)
- [tituswinters](https://github.com/tituswinters)

## Open questions

Placement restrictions of digit separators:

- The core team had consensus for the proposed restricted placement rules.

Use `_` or `'` as the digit separator character:

- The core team deferred this decision to the painter.
- The painter selected `_`.

## Rationale

The proposal provides a syntax that is sufficiently close to that used both by
C++ and many other languages to be very familiar. However, it selects a
reasonably minimal subset of the syntaxes. This minimal approach provides
benefits directly in line with both the simplicity and readability goals of
Carbon:

- Reduces unnecessary choices for programmers.
- Simplifies the syntax rules of the language.
- Improves consistency of written Carbon code.

That said, it still provides sufficient variations to address important use
cases for the goal of not leaving room for a lower level language:

- Hexadecimal and binary integer literals.
- Scientific notation floating point literals.
- Hexadecimal (scientific) floating point literals.

### Painter rationale

The primary aesthetic benefit of `'` to the painter is consistency with C++.
However, its rare usage in C++ at this point reduces this advantage to a very
small one, while there is broad convergence amongst other languages around `_`.
The choice here has no risk of significant meaning or building up patterns of
reading for users that might be disrupted by the change, and so it seems
reasonable to simply converge with other languages to end up in the less
surprising and more conventional syntax space.

0 comments on commit 3bd756c

Please sign in to comment.