auto: useful, annoying or bad practice?

KingJoffrey KingJoffrey at KingJoffrey.com
Fri May 11 03:36:47 UTC 2018


On Monday, 30 April 2018 at 21:11:07 UTC, Gerald wrote:
>
> So I'm curious, what's the consensus on auto?

My rule, is when I can't be bothered typing it all out, or can't 
be bothered working out what it is I'm actually meant to type, 
then I use auto (or var).

i.e. I use it as a time saver, and that's all.

The exception to that rule, is when it's important to the person 
writing/reading that code, to known what type is being used (and 
that's a rather subjective decision). In most cases, the type 
declaration is for other reasons (i.e not human consumption).

btw. In 1969, John C. Reynolds published his paper/specification 
on GEDANKEN - a typeless programming language, and type 
declaration was simply not permitted.

(Gedanken is German for thought experiment, more or less)

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.492.9205&rep=rep1&type=pdf

I wonder whether this is where languages will eventually end up 
again, in the future some time.



More information about the Digitalmars-d mailing list