Search code examples
programming-languagesmultiple-languages

Are there any reasons not to use "this" ("Self", "Me", ...)?


I read this answer and its comments and I'm curious: Are there any reasons for not using this / Self / Me ?

BTW: I'm sorry if this has been asked before, it seems that it is impossible to search for the word this on SO.


Solution

  • Warning: Purely subjective answer below.

    I think the best "reason" for not using this/self/me is brevity. If it's already a member variable/function then why redundantly add the prefix?

    Personally I avoid the use of this/self/me unless it's necessary to disambiguate a particular expression for the compiler. Many people disagree with this but I haven't ever had it be a real sticking point in any group I've worked for.