On Monday, 1 July 2013 at 16:46:57 UTC, Ary Borenszweig wrote:
On 7/1/13 1:45 PM, John Colvin wrote:
T)(T var)
{
    auto myVar = var.to!string;
    //do something with myVar string
}

Ah, that's also ok. But then you have to remember to use myVar instead of var.

Personally I like the explicit use of a new variable. If you're changing the type of a variable then you want it to be explicit. I spend far too many hours a month chasing down accidental type changes in python.

A "convenience" feature is only a feature if it helps *stop* you shooting yourself in the foot, not if it actively encourages it.

auto a;

//loads of code, with function calls to all sorts of unfamiliar libraries

//do something with a.

How do I know what type a is to work with? I have to either read and understand all the code in between, try and write something generic, or put a pragma(msg, ...) in to show it for me. Either way I have to pray that nobody changes it.

Reply via email to