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

Oliver Wolff Oliver.Wolff at qt.io
Wed Feb 26 15:10:05 CET 2020


Hi,

On 21/02/2020 13:57, Mitch Curtis wrote:
>> -----Original Message-----
>> From: Eike Ziller <Eike.Ziller at qt.io>
>> Sent: Friday, 21 February 2020 1:55 PM
>> To: Mitch Curtis <mitch.curtis at qt.io>
>> Cc: Ville Voutilainen <ville.voutilainen at gmail.com>; 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 21. Feb 2020, at 13:30, Mitch Curtis <mitch.curtis at qt.io> wrote:
>>>
>>>> -----Original Message-----
>>>> From: Development <development-bounces at qt-project.org> On Behalf
>> Of
>>>> Ville Voutilainen
>>>> Sent: Friday, 21 February 2020 12:16 PM
>>>> To: Alex Blasche <alexander.blasche at qt.io>
>>>> Cc: 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 10:42, Alex Blasche <alexander.blasche at qt.io>
>> wrote:
>>>>> I think a fallback to
>>>>>
>>>>> somethingChanged()
>>>>>
>>>>> 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.
>>
>> It isn’t because you can put “emit” anywhere in your code because it has no
>> semantics for the compiler.
> 
> I never said it had any semantic purpose, I'm purely arguing that it has implications for readability.

I agree with Mitch here. For me the emit has value. It's just an 
annotation, but for me it serves a purpose. I can see that this is a 
signal emission and even if people keep arguing that this is pointless 
it serves a purpose to me. "Look here a signal is emitted, so that other 
parts who are interested in this information might react". For me that's 
important information when reading code (be it while coding or in code 
reviews).

Now everyone can tell me, that I am stupid and that is not necessary, 
but to me it looks, like people are jumping the "I agree" train and 
people who disagree are somewhat "intimidated" and do no longer dare to 
voice that.

My 5 cents,
Olli

> 
>> It’s not beter than any code comment that you could also put there, like
>>
>> /*emit*/ something();
>>
>> or
>>
>> something(); // emit
> 
> I disagree; I think those are ugly.
> 
>>> Not all signals follow the *Changed() naming convention, nor should they,
>> so it becomes even less obvious in those cases.
>>>
>>>> _______________________________________________
>>>> Development mailing list
>>>> Development at qt-project.org
>>>> https://lists.qt-project.org/listinfo/development
>>> _______________________________________________
>>> Development mailing list
>>> Development at qt-project.org
>>> https://lists.qt-project.org/listinfo/development
>>
>> --
>> Eike Ziller
>> Principal Software Engineer
>>
>> The Qt Company GmbH
>> Erich-Thilo-Straße 10
>> D-12489 Berlin
>> eike.ziller at qt.io
>> http://qt.io
>> Geschäftsführer: Mika Pälsi,
>> Juha Varelius, Mika Harjuaho
>> Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg,
>> HRB 144331 B
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
> 


More information about the Development mailing list