[Development] A modest proposal: disable lower-case keywords (emit, foreach, forever, signals, slots) by default
Philippe
philwave at gmail.com
Wed Feb 26 13:47:44 CET 2020
>>Were neither enforcing the use of emit currently. And I honestly
>> find most of the alternatives to be worse than no annotation at all.
As an illustration, for many years, I have the naming convention to
start all my signals with... "signal"
eg. signalChange();
This notation is so intuitive that I often forget to write "emit" before the
call.
Philippe
On Wed, 26 Feb 2020 12:30:09 +0000
Lars Knoll <lars.knoll at qt.io> wrote:
>
>
> > On 26 Feb 2020, at 10:38, Alex Blasche <alexander.blasche at qt.io> wrote:
> >
> >
> >
> >> -----Original Message-----
> >> From: Lars Knoll <lars.knoll at qt.io>
> >>>> Im not trying to make this only about emit. But its the concrete
> >>>> problem were facing now, and emit is IMO the one keyword where we
> >>>> simply dont need a replacement because it has no real semantic meaning in
> >> C++.
> >>>
> >>> I don't think semantics matter here. It is all about annotation and readability.
> >> With the same arguments we design APIs. While Kai's survey is inconclusive
> >> about the actual solution, it is conclusive in one aspect. There is a clear majority
> >> to have sth in place for annotation/readability purposes.
> >>
> >> As Kai said, in this case a comment would do the trick just as well, no need for a
> >> keyword or macro:
> >>
> >> /*emit*/ mySignal(); or
> >> mySignal(); // emit
> >
> > Can you see us adopting a coding style that enforces the use of such comments? Otherwise this will quickly change to comments being forgotten which makes the above suggestion less valuable. Although the alternatives have no semantics either they impress a stronger coding style than comments IMO.
>
> Were neither enforcing the use of emit currently. And I honestly find most of the alternatives to be worse than no annotation at all.
>
> Cheers,
> Lars
>
> >
> > --
> > Alex
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
More information about the Development
mailing list