Why not allow mutation of the this binding?

Posted by gnucom on Stack Overflow See other posts from Stack Overflow or by gnucom
Published on 2010-06-10T00:03:00Z Indexed on 2010/06/10 0:12 UTC
Read the original article Hit count: 488

Hi Everyone,

I'm building a interpreter/compiler for a school project (well now its turning into a hobby project) and an instructor warned me not to allow mutation of the 'this' binding (he said it was gross and made a huge deal about it) but I never learned why this is so... dangerous or bad. I'm very curious about why this is so bad. I figured this sort of feature could be useful in some way or another.

I'm wondering if anyone familiar with building languages can tell me what sort of problems mutation on the 'this' binding can cause, and if they know of any cool or useful tricks that one could do if it actually was allowed.

Do any languages that you're aware of allow mutation of 'this'?

Thanks,

© Stack Overflow or respective owner

Related posts about compiler

Related posts about programming-languages