Automatic typing

Walter Bright newshound2 at digitalmars.com
Fri Jun 28 19:05:36 PDT 2013


On 6/28/2013 6:48 PM, JS wrote:
> What was the use case for auto that got in into the language?

In code where the type of the initializer would change, and if the type of the 
variable was fixed, then there would be an unintended implicit conversion. The 
other use case was voldemort types. Such patterns are commonplace, and a source 
of error and inconvenience without auto. auto appears in various forms in other 
languages, and is almost universally lauded as worthwhile.

These cases don't apply to this proposal, nor do I know of its successful 
adoption in another language.

It's not a matter of finding reasons not to implement it. It's finding reasons 
TO implement it. Language features do not have zero cost - some benefit has to 
offset it.


More information about the Digitalmars-d mailing list