Skip to content

Upper-case vs Lower-case for expressions #3271

Closed

Description

@brevzin

Throughout the language part of the standard, arbitrary expressions are introduced in lower-case, .e.g:

The set of potential results of an expression e is defined as follows:

And arbitrary types are introduced in upper-case, e.g.:

A class type T must be complete if:

Both of those are from [basic.def.odr], but it's consistent throughout the language section.


Much of the new library wording from Ranges breaks this convention by introducing expression in upper-case in all the definitions of the CPOs. For instance, from [range.access.begin]:

The expression ranges​::​​begin(E) for some subexpression E is expression-equivalent to:

Is there a particular reason why the Ranges wording uses capital letters for expressions instead of lower-case?

Activity

  1. jensmaurer commented on Oct 3, 2019

    @jensmaurer
    Member

    [algorithms] uses "Let $E$ ..." (using E as a meta-variable for an expression) pervasively.

    @CaseyCarter, any opinion here?

  2. CaseyCarter commented on Oct 4, 2019

    @CaseyCarter
    Contributor

    IIRC [algorithms] inconsistently used both \tcode{E} and $E$ as expression placeholders before applying P0896. We chose to use the former as precedent for the placeholder in the CPO specifications. The change to use $E$ consistently throughout [algorithms] happened in San Diego when I was integrating all of the range algorithm specifications into the std flavors.

    I have a mild preference for $E$ - whose slanted font makes it "clearly" a meta-syntactic variable - over e - which is itself valid syntax for a C++ expression - as a placeholder, but I'll agree that any consistent style would be an improvement over what's in the working draft right now.

  3. jensmaurer commented on Oct 4, 2019

    @jensmaurer
    Member

    The general idea for \tcode vs. (e.g.) math formatting is that the former could be valid source code, given the right environment, whereas the latter is used for meta-variables in other situations, such as "atomic operations" or similar. So, using $E$ in the [algorithms] section for stuff that looks like valid code snippets is questionable. However, using lowercase "e" for the CPO specification (in harmony with the core language section) might make sense.

  4. added
    decision-requiredA decision of the editorial group (or the Project Editor) is required.
    on Oct 4, 2019
  5. jensmaurer commented on Oct 21, 2019

    @jensmaurer
    Member

    Editorial meeting:

    • Do we want a consistent capitalization convention for the core language part, for types vs. expressions.
    • Do we want to apply this to the library part as well?
    • What should the convention be?

    Deferring.

  6. tkoeppe commented on Nov 4, 2019

    @tkoeppe
    Contributor

    image

    image

  7. jensmaurer commented on Nov 4, 2019

    @jensmaurer
    Member

    Editorial meeting: Use math variables for everything, including types. \placeholder remains for exposition-only names and forming parts of an identifier. Range-based for: explain range/begin/end as exposition-only identifiers. Use $T$ primarily, possibly with index, for types. Additionally, use $U$, $V$ for types unrelated to $T$. Use $E$ for expressions, possibly with subscript.

  8. removed
    decision-requiredA decision of the editorial group (or the Project Editor) is required.
    on Nov 4, 2019
  9. jensmaurer commented on Nov 19, 2019

    @jensmaurer
    Member

    See also #326, #3139.

  10. added
    bigAn issue causing a large set of changes, scattered across most of the text.
    on Dec 15, 2019
  11. self-assigned this
    on Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bigAn issue causing a large set of changes, scattered across most of the text.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions