Automatic typing
    Walter Bright 
    newshound2 at digitalmars.com
       
    Mon Jul  1 09:59:58 PDT 2013
    
    
  
On 7/1/2013 9:46 AM, 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.
Heck, why bother with different variable names at all? We can just use x for all 
variables, t for all types, and f for all functions!
t f(t x)
{   t x;
     t x = x & 0xFF;
     if (x == x)
         x = 0;
     else if ((x & 0xFFFD00) == 0x0F3800)
         x = x[(x >> 8) & 0xFF];
     else if ((x & 0xFF00) == 0x0F00)
         x = x[x];
     else
         x = x[x];
     return x & x;
}
Sorry for the sarcasm, but I just don't get the notion that it's a burden to use 
a different name for a variable that has a different type and a different 
purpose. I'd go further and say it is a bad practice to use the same name for such.
    
    
More information about the Digitalmars-d
mailing list