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

Kai Köhne Kai.Koehne at qt.io
Thu Feb 20 14:44:23 CET 2020


> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Marc Mutz via Development
> Sent: Saturday, February 15, 2020 3:24 PM
> To: development at qt-project.org
> Subject: [Development] A modest proposal: disable lower-case keywords
> (emit, foreach, forever, signals, slots) by default
> 
> Hi,
> 
> C++20 will contain new classes with emit() member functions
> (wg21.link/P0053). While that will only pose problems for users that include
> the new <osyncstream> header after (almost) any Qt header, this should serve
> as a second shot across the bows (after namespace
> boost::signals) that we should change something.
> 
> To that effect, I'd like to propose that we switch the default for
> QT_NO_KEYWORDS around.

As a counter proposal that (I hope) would get broader consensus,  I suggest to just do this for 'emit': QTBUG-82379 .

This keyword always seemed a bit odd to me anyway, because it has no semantics that's ensured by the compiler. I understand the ratio behind it, and there's obviously tons of code that uses it. But if I have the choice between

  Q_EMIT somethingChanged();

and just

 somethingChanged();

I personally prefer the second.

My 2 cents,

Kai



More information about the Development mailing list