"with" still sucks + removing features + adding features

Yigal Chripun yigal100 at gmail.com
Mon May 18 23:43:55 PDT 2009


Andrei Alexandrescu wrote:
> To be brutally honest, I think many features discussed here are 
> completely missing the point. Only a couple of posts ago, there were 
> suggestions for alternate syntaxes for "with" that were not only 
> useless, they added new keywords like they were up for grabs. If 
> somebody wants to make "as" into a keyword, I'm liable to go postal. 
> More to the point, I forgot the exact context, but recently a poster 
> wrote a long message describing how he wants simultaneously two 
> completely antagonistic features, to finally (and to his credit) 
> courageously face the inevitable truth: that he had no idea what he 
> really wanted. This is happening a lot in this group, just that most of 
> the time it goes undetected.
> 

> Andrei

we don't need any new syntax to get rid of with.
most of the time you use it like (for example):

for (int i = 0; i < 10; ++i) {
   with (myLongVar[i].myLongMember.MylongOtherMember) {
     myLongMethod();
   }
}

so why not allow:
for (int i = 0; i < 10; ++i) {
   alias myLongVar[i].myLongMember.MylongOtherMember tempSymbol;
   tempSymbol.myLongMethod();
}

this doesn't add any new syntax



More information about the Digitalmars-d mailing list