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

Allan Sandfeld Jensen kde at carewolf.com
Fri Feb 21 12:56:21 CET 2020


On Friday, 21 February 2020 12:44:56 CET Allan Sandfeld Jensen wrote:
> On Friday, 21 February 2020 12:28:29 CET Giuseppe D'Angelo via Development
> 
> wrote:
> > Il 21/02/20 12:15, Ville Voutilainen ha scritto:
> > >> without any annotation is not what we want. We'd miss vital information
> > >> and reduce readability.>
> > > 
> > > Can you please explain what that vital information is?
> > 
> > That control is leaving the "local" function, and *anything* can happen
> > at that point. Including fun stuff, like finding "this" to be deleted
> > (pgrep for QPointer.*this in QWidget code). It's an important annotation
> > for a developer IMNSHO.
> 
> That information could be preserved if we named the signal functions
> emitSignalName instead, though that would look worse at the binding.
> 
Hmm.. Or perhaps:

#define qEmit(x) x
or
#define qEmit(x) do { x; } while (false) 
to handle the syntactic edge cases.

Would also make it possible to define an alternative pattern we use a lot
in QtWebEngine, a qAsyncEmit() that would emit over a 0 time singleShot
timer (basically handle all listeners after returning to the event loop)

'Allan








More information about the Development mailing list