"with" should be deprecated with extreme prejudice

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon May 18 04:36:19 PDT 2009


bearophile wrote:
> Lars T. Kyllingstad:
> 
>> f one really wants to avoid typing, just use alias:
>>     alias my.very.long.string.of.symbols x;
>>     a = x.foo;
>>     x.foo = b;
> 
> See my suggestion (where there's a p instead of s:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=90439
> 
> Bye,
> bearophile

Sorry, I didn't see that you had already made the suggestion.

I don't think there is any need to extend the alias syntax, though. If 
you only want the alias to work in a limited scope, just enclose it in one:

     int x, y;
     {
         alias another.very.long.name s;
         y += s.x;
         s.x = x;
     }
     s.x = 1; // Doesn't work, s is not in scope.



-Lars



More information about the Digitalmars-d mailing list