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

Allan Sandfeld Jensen kde at carewolf.com
Mon Feb 24 16:17:09 CET 2020


On Monday, 24 February 2020 15:03:41 CET Ville Voutilainen wrote:
> On Mon, 24 Feb 2020 at 15:52, Ville Voutilainen
> 
> <ville.voutilainen at gmail.com> wrote:
> > On Mon, 24 Feb 2020 at 14:42, Lars Knoll <lars.knoll at qt.io> wrote:
> > > But we could convey the information that this is a signal you’re calling
> > > *reliably* through other means. This implies that the keyword is not
> > > required.> 
> > Was the keyword ever required? Seems like it's just a taste difference
> > from a
> > 
> > qEmit(my_signal());
> > 
> > to write
> > 
> > emit my_signal();
> > 
> > The first one can be namespaced, and thus its name lookup controlled.
> > It also never clashes with a member name.
> > Its worse aesthetics aside, if we'd had that since the beginning, we
> > wouldn't be talking about the current clashes
> > with std::osyncstream.
> 
> Hah, except it of course doesn't work with my_signal that returns void.

Yeah you would need something like qEmit(&my_signal, Args..) or without & 
using a macro. Or.. qEmit(std::bind(&my_signal, Args...));

'Allan




More information about the Development mailing list