On Aug 23, 2008, at 8:23 AM, Fergus Cooney wrote:

> Another use I have for redeclaring variables is when I want to  
> reuse the
> name but there's a clear separation between the previous use and  
> the new
> use. For example, I might have a variable to amass a bunch of html  
> snippets
> and then stick them in a div. I'll redeclare that variable again if  
> I'm
> doing separate content for another div. It makes it explicit that  
> there's no
> carry-over from above. Also, as I'm the declare-everything-first  
> type, it
> also helps if I decide rearrange the code.

That last point is a great one.

We did talk about redundant declarations when discussing strict mode.  
IIRC we agreed not to punish them, mainly for the last reason and the  
consequent abundant use of var in several paragraphs of code where  
the vars have the same name and hoist to the same body scope, and  
nothing's formally wrong with the code.

We can't have strict mode exact an inordinate migration tax, or it  
won't be used. We shouldn't make it too pedantic, or it will either  
not be used, or else waste programmer energy on non-problems or  
hypothetical problems.

/be

_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to