Skip to content

[range.split.outer,range.split.inner] "current" placeholder vs. current_ exposition-only member #3851

Open
@jensmaurer

Description

@jensmaurer
Member

Some misuse was fixed in #3849, but having these two near-identical identifiers with different semantics is prone to cause further mix-ups.

Find a better name for one of them.

Activity

added
decision-requiredA decision of the editorial group (or the Project Editor) is required.
on Mar 10, 2020
JohelEGP

JohelEGP commented on Mar 10, 2020

@JohelEGP
Contributor

How about renaming current to effective-current?

CaseyCarter

CaseyCarter commented on Mar 10, 2020

@CaseyCarter
Contributor

I'd like to avoid anything of the form "xxx-current"/"current-xxx" if we can. Now that all of the private variables have been kebab-cased, it's too easy to confuse the exposition only name foo-bar with an expression that calculates the difference of the two exposition-only names foo and bar.

JohelEGP

JohelEGP commented on Mar 10, 2020

@JohelEGP
Contributor

Ah, right. IIRC, the dash replaced underscores in exposition-only names to make that property more obvious. Now that they're kebab-cased, underscores should once again be viable.

jwakely

jwakely commented on Mar 10, 2020

@jwakely
Member

One option would be to define current() as a pair of exposition-only member functions (const and non-const), and we could specify them precisely:

constexpr auto& current() {
 if constexpr (forward_range<Base>)
  return current_;
else
  return parent_.current_;
}

The distinction between current_ and current() still isn't huge, but the parentheses would help.

Or there's always CURRENT in the style of INVOKE, but we've moved away from that to kebab-case.

tkoeppe

tkoeppe commented on Jun 16, 2025

@tkoeppe
Contributor

Editorial meeting decision: we like the suggestion by @jwakely; pull request welcome!

self-assigned this
on Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

decision-requiredA decision of the editorial group (or the Project Editor) is required.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @CaseyCarter@jwakely@tkoeppe@JohelEGP@jensmaurer

      Issue actions

        [range.split.outer,range.split.inner] "current" placeholder vs. current_ exposition-only member · Issue #3851 · cplusplus/draft