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

Mitch Curtis mitch.curtis at qt.io
Fri Feb 21 13:54:44 CET 2020


> -----Original Message-----
> From: Ville Voutilainen <ville.voutilainen at gmail.com>
> Sent: Friday, 21 February 2020 1:42 PM
> To: Mitch Curtis <mitch.curtis at qt.io>
> Cc: Alex Blasche <alexander.blasche at qt.io>; development at qt-project.org
> Subject: Re: [Development] A modest proposal: disable lower-case
> keywords (emit, foreach, forever, signals, slots) by default
> 
> On Fri, 21 Feb 2020 at 14:30, Mitch Curtis <mitch.curtis at qt.io> wrote:
> 
> > > > 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?
> > How can you tell if it's a signal being emitted or just a function call without
> the emit syntax? With the emit syntax before the signal emission, it's
> immediately obvious that it's a signal. Not all signals follow the *Changed()
> naming convention, nor should they, so it becomes even less obvious in
> those cases.
> 
> Why do I need to know that it's a signal being emitted? How is that "vital
> information"? I could just as well invoke any other callback, but I find myself
> not exactly yearning for being able to write callback somethingHappened();

I can't answer why you need to know, but for me personally, it's just one less small thing to think about. I'm not going to try to step into it while debugging, for example, and end up in some tasty moc guts. It's like const on local variables; a lot of people leave it out but I like having it because it's one less thing to consider when I'm already tired and have been thinking all day. :)

Having the emit syntax costs the people who don't want to use it nothing, and I know which code I'd rather have to maintain.


More information about the Development mailing list