Question about JavaScript Privates and Publics

I’ve seen multiple posts discussing a potential bug in the implementation of the JavaScript this construct. I’ve seen it implied that the following code should fail all of the time:

function myFunc(name){

  this.name = "outer";
  // Without the following reference...
  var that = this;

  function test(){
    // ...this will not work as expected...
    alert(this.name);
    //...but that will.
    alert(that.name);
  }

  test();
}

When in my experience, the only time this code will not behave as expected is quite well explained here.

Does anyone have a set of rules for choosing when to apply the following:

var that = this

In the Heat of the Night

This movie has been on my list to see for a long time, and last night Janna and I popped it into the DVD player and watched it. More appropriately I got quite distracted by it and paid more attention to it than any movie I’ve watched recently.

The context of the famous quote delivered by Sidney Poitier, and redelivered by many people during my life now makes sense.

A day later, I rank the movie as one of the best I have ever seen. Much like the reason my favorite novel is Catch 22, I appreciate the movie less for the story and more because of a single character.

Virgil Tibbs isn’t the black messiah. He’s not nice, he’s not mean, and to me, he’s not “black” or “not black.” His character, played brilliantly by the actor, triumphs by embracing the fact that he is human, one with a unique set of problems, just as different as everyone else.

Brilliant, absolutely brilliant.

Back in a W2

In February of 2007 I quit my W2 job as a Sales Engineer to go write the great American novel.

I quickly realized that I needed at least some way to make income, so I became a rent-a-nerd.

In October of 2008 I listend to Barry Eisler give a lecture at my writer’s club. Sure everyone had been telling me, but he was the first one who I believed when he said, “Don’t quit your day job. It took me 8 years to sell my first novel.”

Damn.

In June of 2008 I attended Eclipse Day at the Googleplex. My good friend Rob invited me to it, and I’m very happy he did.

Now I’m back in the W2 world as a 32 year old first time software engineer. Rob, who I consider very smart, always says how he works with some really smart people that make him feel not so smart. I now understand how he feels.

But I’m happy in a W2 job, for perhaps the first time in my life.