Re: [isocpp-modules] inline and constexpr variables in modules [was: [core] gb079 update]

9 views
Skip to first unread message

Richard Smith

unread,
Dec 17, 2019, 5:51:05 PM12/17/19
to mod...@isocpp.org, David Stone
On Tue, Dec 17, 2019 at 2:04 PM David Stone via Modules <mod...@lists.isocpp.org> wrote:
On Wed, Dec 11, 2019 at 6:53 PM Gabriel Dos Reis via Modules <mod...@lists.isocpp.org> wrote:

Named modules make ‘inline’ redundant for exported constexpr (or any other) variable.

We should resist temptation to require more annotation/declaration that most programmers consider noise.

 

-- Gaby


Completely agreed. I would not look forward to having to explain to people why you can export a non-constexpr variable without doing anything special, but if you want to export a constexpr variable you also need to include the "inline" keyword, which is a keyword that seems completely meaningless for variables in a modules world to the regular programmer. I think it would be ideal if it were meaningless on variables in a module, not just seemingly meaningless.

I agree that simplifying the language by removing any necessity for, or meaning of, 'inline' in modules would be a good thing (ignoring any consequences). What's not clear to me is why there should be a difference between functions and variables in this regard.

If we're saying that 'inline' controls the exported interface, it seems like we should say that consistently. Maybe the way we get there is by saying that constexpr implies inline for variables attached to a module? (We wanted to do that when we introduced the notion of inline variables, but were prevented from doing so for backwards-compatibility reasons).
Reply all
Reply to author
Forward
0 new messages