[Development] RFC: more liberal 'auto' rules?

Knoll Lars Lars.Knoll at theqtcompany.com
Mon Dec 7 13:11:58 CET 2015

On 07/12/15 14:05, "Development on behalf of Marc Mutz" <development-bounces at qt-project.org on behalf of marc.mutz at kdab.com> wrote:

>On Monday 07 December 2015 12:23:41 Oswald Buddenhagen wrote:
>> On Fri, Dec 04, 2015 at 10:29:09PM +0100, Marc Mutz wrote:
>> > On Friday 04 December 2015 19:06:51 Oswald Buddenhagen wrote:
>> > > it's not that anyone is confused, it's that your "aside" was
>> > > inherently flawed: variables in python are dynamically typed, so the
>> > > suggestion that they are "auto" in any way related to c++ makes no
>> > > sense whatsoever. my response aimed merely at showing that even your
>> > > little "joke" was off.
>> > 
>> > Again: I was referring to the omission of any form of type name when
>> > declaring variables. That Python is _also_ dynamically typed is
>> > correct, but irrelevant.
>> then maybe you want to explain how you want to implement auto
>> *everywhere* without going dynamic. until you provide a credible answer
>> to that, your "aside" is patently irrelevant. hint: c# type inference
>> does *not* provide that answer.
>I have explained it as good as I can. If you can or do not want to understand, 
>then I'm sorry that I cannot explain it so you understand.

Auto has nothing to do with anything being dynamically typed, as the type of an auto variable is defined by the way it’s being initialised. So let’s close that part of the discussion. We aren’t loosing static type information/checking just because we start using auto.

I am personally not seeing why we need extremely strict and/or detailed rules governing our usage of auto. Basically we should optimise our code for readability. If that makes refactoring easier, it’s an added benefit, but it’s not the primary goal I believe we should aim for. So let's start using auto in all places where it helps readability. I personally think an ‘always use auto’ policy is overdoing it, but I do believe we can be relatively liberal in it’s use without sacrificing readability (and often improving it by doing so).


More information about the Development mailing list