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

Matthew Woehlke mwoehlke.floss at gmail.com
Fri Feb 28 21:07:10 CET 2020


On 28/02/2020 13.37, Konstantin Tokarev wrote:
> 28.02.2020, 21:34, "Thiago Macieira" <thiago.macieira at intel.com>:
>> On Friday, 28 February 2020 07:28:34 PST Matthew Woehlke wrote:
>>>  If we had to do it over again, it might make sense to follow Python and
>>>  make signals *objects* instead of *methods*. Then the code would look like:
>>>
>>>    this->emptied.emit(...);
>>
>> Binary compatibility issue: if it's a member of the class, it can't be added
>> or removed without changing the class's size and layout, so it would tie our
>> hands for future improvements.
>>
>> You'd see instead:
>>
>>     this->emptied().emit(...);
>>     connect(foo, foo->emptied(), ...);
> 
> I think it could be a static member as well - there is no real reason for such member
> to be per-instance in the first place.

If it was static, you'd have to pass the instance to `emit(...)`.
Otherwise you don't know what instance sent the signal.

-- 
Matthew


More information about the Development mailing list