CSS vs. Javascript
On Jan 5, 2007, at 1:06 PM, P T Withington wrote:
Was any thought given to permitting:
#F00D1E
notation for hex literals in Javascript? I get a lot of grief
because you can use that notation in CSS but not in Javascript.
Interesting; I've never heard such complaints. Perhaps not enough
use-cases in the browser for hex-numbered CSS colors?
Minor conflict with SpiderMonkey's CL-inspired sharp variables:
var cyclic = #1={kid: {parent: #1#};
Possibly other implementations use # in extensions? It's in demand,
at least on the first line and followed by !, as a comment-to-end-of-
line delimiter.
Taking a bigger leap: what about dimensioned values in
Javascript? Too far out?
See www.mozilla.org/js/language/js20/rationale/units.html -- I
used to encourage Waldemar to fit this into his JS2 spec, and it
still seems like it would be appreciated in browser-like embeddings
(more useful than # for hex :-P). We left it out of ES4 as part of a
triage, to fit ES4 work into a schedule that converges in the first
half of this year. I could see implementations experimenting with it
and a follow-on spec emerging.
Anyone think it's really important to do in ES4?
Brendan Eich scripsit:
See www.mozilla.org/js/language/js20/rationale/units.html -- I
used to encourage Waldemar to fit this into his JS2 spec, and it
still seems like it would be appreciated in browser-like embeddings
(more useful than # for hex :-P). We left it out of ES4 as part of a
triage, to fit ES4 work into a schedule that converges in the first
half of this year. I could see implementations experimenting with it
and a follow-on spec emerging.
Strongly typed dimensioned numbers are a horrible rathole that projects go down but don't emerge from. A small indication of the difficulty of the effort is the fact that "kg m^2 / s^2" is the unit of both torque and energy, yet adding them makes no sense; another indication is that length, width, and height are all measured in meters, but adding them makes no physical sense either (except when you are checking packages to see if they meet parcel-post regulations, which require that L+2W+2H <= 3m). Then there is the problem of having multiple scales, sometimes multiplicative (like feet instead of meters), sometimes additive (like degrees Celsius instead of kelvins), and sometimes both.
I could go on, but I won't. I have read a 400-odd-page report by one group of language designers who spent several years trying to solve these and many, many other problems. They failed, and published their notebooks as-is in hope that someone else would be able to work on the problem.
Anyone think it's really important to do in ES4?
shudder
No, indeed.
On Jan 5, 2007, at 11:54 PM, Brendan Eich wrote:
On Jan 5, 2007, at 1:06 PM, P T Withington wrote:
Was any thought given to permitting:
#F00D1E
notation for hex literals in Javascript? I get a lot of grief
because you can use that notation in CSS but not in Javascript.Interesting; I've never heard such complaints. Perhaps not enough
use-cases in the browser for hex-numbered CSS colors?Minor conflict with SpiderMonkey's CL-inspired sharp variables:
var cyclic = #1={kid: {parent: #1#};
Possibly other implementations use # in extensions? It's in
demand, at least on the first line and followed by !, as a comment- to-end-of-line delimiter.
Opera has supported CPP-style #ifdefs in the past, though this has
not been documented. I think it would be nice to reserve # for other
things than hex literals, especially given that we have a notation
for those already.
Was any thought given to permitting:
#F00D1E
notation for hex literals in Javascript? I get a lot of grief
because you can use that notation in CSS but not in Javascript.
Taking a bigger leap: what about dimensioned values in Javascript?
Too far out?