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

Jean-Michaël Celerier jeanmichael.celerier at gmail.com
Wed Feb 26 10:27:57 CET 2020


> 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.

You should I think take into account that the whole C++ community manages
to do just fine without annotating calls to std::function (or
$any_other_signal_slot_library_in_the_universe) in the same way - even
though all of the "dangers" can still apply.

On Wed, Feb 26, 2020 at 9:18 AM Alex Blasche <alexander.blasche at qt.io>
wrote:

>
>
> > -----Original Message-----
> > From: Development <development-bounces at qt-project.org> On Behalf Of Lars
> > Knoll
>
>
> > I’m not trying to make this only about emit. But it’s the concrete
> problem we’re
> > facing now, and emit is IMO the one keyword where we simply don’t 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.
>
> > > Qt relies on macros a lot, and while I have not followed the latest
> Modules
> > development, I'm sure macros pose a problem for a modularized Qt, too
> > >
> > > So while emit is the latest in the line of macro clashes, it's not the
> first and it
> > likely won't be the last. So, please, just removing 'emit' because it's
> easy doesn't
> > solve the problem for `signals` and `slots`.
> > >
> > > <dreaming>Can access specifiers have attributes....?
> > > public [[qt::slots]]:
> > > </dreaming>
> >
> > Why do we need it, if functions can already have attributes?
>
> Because it is in the wrong spot. I want to spot the signal call in a cpp
> file and not a header. I must assume that the reason why we had emit in the
> first place (besides "slots" and "signals") is the same.
>
> > public:
> > [[qt::slot]] void mySlot();
> >
> > protected:
> > [[qt::signal] void mySignal();
>
> I’d love to have this too (in addition to [[qt::emit]])
>
> --
> Alex
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200226/183684b3/attachment.html>


More information about the Development mailing list