[Development] A modest proposal: disable lower-case keywords (emit, foreach, forever, signals, slots) by default

Matthew Woehlke mwoehlke.floss at gmail.com
Tue Feb 25 21:17:13 CET 2020


On 25/02/2020 14.58, Ville Voutilainen wrote:
> On Tue, 25 Feb 2020 at 21:37, Matthew Woehlke wrote:
>> - Until now, `emit` has rarely been used in code that needs to mix with Qt.
>>
>> - C++20 will have modules.
>>
>> - Modules are theoretically immune to the above issue.
> 
> Module definitions are immune to macros affecting what they export,
> but client code is not
> immune to mixtures of module imports and header includes when the
> latter defines a macro.
> If you import a Std.IOStream module and then include QObject, you
> can't call std::osyncstream::emit().

Right, and when I realized that, it got me wondering, how many people
will need to call that specific function that are *also* using Qt *and*
will be unwilling to use Q_NO_KEYWORDS to work around the issue?

It's not as dire as not being able to use that module *at all*, directly
*or indirectly*¹, in code that also uses Qt. More likely, it will be
boost::signals again, which doesn't seem to have been a catastrophe.

(¹ ...if your other third-party dependencies modularize, or don't use
that method in headers.)

-- 
Matthew


More information about the Development mailing list