unscriptable.com ๏ฟฝ JSLint puked on my javascript!:

Iโ€™m not sure what specs you were looking at but ECMAScript defines the following syntax:

if ( Expression ) Statement else Statement
if ( Expression ) Statement

{โ€ฆ} (a block) is technically a statement in itself (a statement that contains statements). I tend to use blocks because, oddly, I find them more readable.


JSLint apparently told the OP not to write code like...
if (!already)
var itemInit = ctrlr._getItemInit(which);
if (itemInit)
// some lines snipped
itemInit.call(ctrlr, root, doneMap);


You needed brackets, JSLink said. The OP thought Javascript's specs backed JSLint. (Aside: I know, it's apparently supposed to be JavaScript, but we've already talked about style rules.) The commenter claims ECMAScript says that's not the case.

I think JSLint is useful but crazy. It's fun to see I'm not alone. Also fun to see searching for JSLint foibles turns up hits like this.

Edit: Crockford really is a little crazy. Have you ever heard someone speak in so many absolutes that wasn't speaking religion? Wait a minute...

Listen to the fetish on perfection. He actually believes it exists. He's Plato. He's stuck in the Renaissance. It's a dated, neurotic, naive worldview. Bizarre.

"There has been no human evolution since the paleolithic age." Oh, okay. This claim drives me mad.

Of course there has been. Are you kidding me? No, we don't have a different number of genes than we used to, if that's what he means. Sure, we could reproduce with a fairly old model of homo sapiens. No, we're not (yet) a new species. /sigh But that's not what evolution is. Rather, that's not all that evolution is.

Here's how evolution works: An organism morphs randomly. It doesn't improve viability. There's no selective advantage. The mutation goes away, or, if zero sum (or only a small disadvantage), it randomly sticks around, hoping to tack itself to other traits that are useful. You know, like widow's peaks or nearsightedness.

Or the mutation improves the organism's selective condition. Crockford might pick up Falk's Braindance (iirc). Mutations happen quickly, at times. There's some evidence our hands became feet in an evolutionary second. WHAM. More footed homo whatevers than not. Our brains? Braindance says we WHAM, got better radiators around our brains. They could be cooled, and they exploded in size and ability. Turns out that was the right way to go, at least in the short run.

The brain didn't grow like mad because we needed to use tools. The randomness allowed us to use tools in a manner than provided a selective advantage for a time. It didn't make us hunters and gatherers. It enabled hunting and gathering.

Get this -- the move to large brains works for programming too. The brain isn't a hunter and gatherer's brain. It's a mutation, ready to try on whatever comes its way. It's not (literally) directed. It's a passive selective system. There's no a priori reason why our mutations can't push us to be better at both -- hunting and gathering and programming. And moonwalking, both kinds.

Can you imagine the real world Fred Flintstone equivalent having this discussion? "We have brains that allowed us to pick fruit from trees with more efficiency, not to be hunters and gatherers. We're not evolved to do this! Our feet were made to allow us to travel between trees quickly, not to run along the savannah! This is madness! We're not made to do this, Nemo!"

The point is that if we forced Fred from the trees to the laptop-equipped cubicle instead of the savannah, he'd have done just as well as we're doing now. In a sense, Crockford's arguing against himself. We haven't changed a heck of a lot, and that means we're even less hunter and gatherer than he assumes. We're simply human. Admittedly, at that incensed point, I stopped listening and got Videobox to save it for me to watch offline later.

/sigh Some smart people get caught up in their own press. Doesn't make them dumb. Makes them lazy. Never be positive. Never. (What? Oh yes, yes I am. Positive, not smart.)

Labels: