C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Translation-unit-local functions that access private class fields

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 22 Jun 2026 10:02:45 -0400
On Monday, 22 June 2026 03:00:55 Eastern Daylight Time Simon Schröder wrote:
> I don’t see an advantage for internal linkage anymore. There is only the
> disadvantage of code organization: I’d be restricted to a single
> implementation file and certainly could not try to separate the public and
> private implementation into separate files.

I do see value in that.

I just don't think the two features need to necessarily be tied to one
another. They are separate problems that need solving.

We could argue that only extension methods (of any access level) could be
marked internal, though. I think that's also a valid approach: the current
class definition is the *public* interface, with all data members plus most
public & protected methods, which get external linkage as they do today. The
extension can then add new methods but no data members, and those can be
(somehow) marked as internal.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-06-22 14:02:59