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

Marc Mutz marc.mutz at kdab.com
Mon Dec 7 15:39:25 CET 2015


On Monday 07 December 2015 13:16:14 Oswald Buddenhagen wrote:
> On Mon, Dec 07, 2015 at 02:05:38PM +0100, Marc Mutz 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.
> 
> have you considered the possibility that *you* are the one who's not
> getting the point? you have not provided *any* sensible argument to
> refute my claim that your analogy is fucked. you just keep repeating
> the obvious.

OK, last try:

- auto everywhere in C++ means that the type of the rhs defines the type of the
  variable
- each variable is still statically typed.
- In particular, you cannot assign, say, an int to the variable and later
  assign it a string.

- in Python, variables are declared with 'var' (IIRC)
- the simiarity with C++ auto is that no type name is visible
  - this is what I was referring to
- the difference to C++ (auto or not) is that in Python, the variable is weakly
  typed / dynamically typed / duck-typed, however you may want to call it.
- in particular, the variable can hold an integer first, then a string, and
  later an object of class type. Conversely, any type can be held in any
  variable.
  - this is orthogonal to the omission of the type name, which C++ auto and
    the whole thread is all about, thus *completely irrelevant* to the
    discussion. I, indeed, have no idea why you ride that particular horse so
    vehemently.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list