Please remove "@this" from code

Topics: Prism v4 - WPF 4
Jun 4, 2010 at 2:08 PM

I think whoever used "@this" as a variable name should be flogged!!  People use Prism as a reference implementation...this is NOT something we need to start seeing in the wild. 

var @this = d as ValidateObject; 

REALLY?!?  Why would you do that??!? 

Jun 4, 2010 at 2:21 PM
r2musings wrote:

I think whoever used "@this" as a variable name should be flogged!!  People use Prism as a reference implementation...this is NOT something we need to start seeing in the wild. 

var @this = d as ValidateObject; 

REALLY?!?  Why would you do that??!? 

 I saw that too. Using "this" as a variable name doesn't even make sense in that method - there couldn't have been any reason for it other than the dev insisting on straying from common sense identifier naming guidelines.

I normally don't care too much about the naming conventions people use - even when they opt for such an unusual language element. But as r2musings said, Prism is seen as a *reference implementation*. So please keep the cowboy coding out of it.

For those who saw this and wondered what the language construct was doing - it is just a way to escape the identifier name so that you could bypass the language rule that disallows using reserved words as identifiers. A far more commonplace (and acceptable) usage of this construct is for string literals that contain backslashes (such as file paths): "\\windows\\system32" can be written as "\windows\system32".

Developer
Jun 4, 2010 at 9:03 PM

Hi,

Thanks for the feedback, we have already let the team know about this. Please keep in mind that this is the first drop, and is not a final version, so all your feedback is really appreciated.

Thanks.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi