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

Thiago Macieira thiago.macieira at intel.com
Wed Apr 15 04:22:50 CEST 2020


On Tuesday, 14 April 2020 20:54:57 -03 Nathan Myers wrote:
> I see that you are confused about the origins of Posix
> and Unix networking practices, as well as WG21's. ISO
> WG21 was convened in 1990. The ntohs etc. macros precede
> 1990. Qt does not.

Yes, it does. The first release was in 1994, but the first papers that talked 
about signals, slots, emission and QObject are from 1989. The PhD thesis by 
one of Trolltech's founders (before founding Trolltech) was still surprisingly 
compileable with Qt 3; for Qt 4 and 5 there was mostly a change about how the 
main window is defined.

> Among thousands, maybe millions of libraries, Qt, all alone
> among them, claims authority on its own say-so to impose new
> keywords on the core language it depends upon.

OpenMP comes to mind too. Another one was the language on top of C to access 
databases, by Oracle (can't recall the name).

And besides, those are empty macros to help a code generator find 
instructions. Hardly new in 1990 and not unique in 2020 either.

> Numerous other libraries could have got clever with macros.
> But they didn't. That was not because they couldn't think of
> it. They are, instead, aware of their place in the ecosystem.

min and max don't come to your mind? See windows.h.

How about major and minor? See sys/sysmacros.h.

> Qt's failing was criticized immediately upon release.

Can you point to the criticism emails or USENET posts? The one comment I 
really know about the release was Matthias Ettrich's post on USENET about it 
being really easy to use and calling to action to create a desktop for Unix.

Then Miguel de Icasa got involved and criticised Qt, but not on the language 
or ease of use, but the licence.

I know a lot of people who criticise moc, even today. But I don't consider it 
any worse than yacc or gperf or any other code generator. If and when the 
standard provides reflection, it may go away. In any case, those complaints 
about moc don't apply: it would still exist, even if the markers it scanned 
for were not macros.

> Each day since, it has again not been fixed: day after day,
> year upon year, failure piling on failure, thousands deep.
> All fixable with one simple patch.

You do realise you cannot patch the thousands of different Qt-based 
applications with a single patch, right? Each and every one of them requires a 
patch. Even a simple search-and-replace can break code if not done properly. 
Ironically, the code most vulnerable is that which already uses QT_NO_KEYWORDS 
and uses a library that uses "signals" as an identifier.

Anyway, the decision is made: we will deprecate the lowercase keyword-like 
macros. But since we don't like to break users' code bases any more than the 
standard does, it needs to be a process over a couple of releases.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Development mailing list