News for hackers. Stuff that matters.
Re:Laconic: A Sane Method of Generating DOM Content in JavaS... by mistercow on Thursday April 26, 2012 @12:30AM (#3892435)
Sort of, but there are some tags you probably don't want to pollute your own top-level namespace with, like a, b, i, object, p, q, and s. There's at least one tag (var) which is not allowed as an identifier on its own.
Re:Laconic: A Sane Method of Generating DOM Content in JavaS... by WiseWeasel on Thursday April 26, 2012 @02:17AM (#3892705)
I think 'a' and 'p' are the only ones among those you'd actually want. I could probably live with with those limitations.
Re:Laconic: A Sane Method of Generating DOM Content in JavaS... by WiseWeasel on Thursday April 26, 2012 @04:55AM (#3893017)
Now that I think about it, that might break a few sortFunction(a,b) {//do stuff with a and b} type functions of mine...
Re:Laconic: A Sane Method of Generating DOM Content in JavaS... by mistercow on Thursday April 26, 2012 @10:20AM (#3894004)
No, it won't break them; it will just make them confusing to read. The scope of the function arguments would be more local, so they would hide the declarations further up the scope chain.

What's more of a problem is if you have something like this: https://gist.github.com/2499913

The problem is that the "var p" in the for loop will be hoisted to the top of the scope, and so when you call p() in the first line, it will actually be undefined.

Re:Laconic: A Sane Method of Generating DOM Content in JavaS... by catch23 on Thursday April 26, 2012 @04:56AM (#3893020)
You could use with(){} in js so you don't have to pollute your global namespace and still have pretty code.
Re:Laconic: A Sane Method of Generating DOM Content in JavaS... by mistercow on Thursday April 26, 2012 @10:06AM (#3893937)
Hardly seems worth it to invoke that confusing construct when you could just pack them in an object with a short name instead.