Whoop
What a funny misunderstanding, sorry, my fault. It's just a
"dash". I didn't mean C--, I meant "Yeah, in C it's possibly so, but..."
I mostly meant (and I already mentioned it in this thread) that a new
language should forward to higher and higher abstraction (although, "the
highest" (e.g. just like a talk with a human) is also possibly won't be
good, because it will lose a generality of abstract description of a
program). But, that's mostly a philosophy.
More exactly I said that in my opinion C's syntax has some "noise" or
inefficient (from the human readability and logic viewpoint!) constructs
(so, they are efficient at the implementation level). And every language
which completely borrows some C's constructs (to be "known and
intuitive" for new programmers) -- Java, JS, PHP etc. "forget" that C
could use such ugly construct because of /problems and issues/ of e.g.
code generation at the implementation level.
Of of such constructs is a "very noisy" C' /switch-case/ construction.
You don't have a human-logical explanation why it works so non-logical
in its control-flow. Why you should pollute your code with that "noise"
like every time to put that useless (again, from the human viewpoint)
/break/ keyword after each case. Why, if you forget that "break", the
control-flow will catch all other cases even if your testing value is
not in this case? Why the "default:" section, being placed not at the
end and without that useless "break" will again carry you through all
/not your/ cases?
But all this becomes very-logical if we look at the auto-generated
assembly code. There all conditions are put at the beginning and after
that described all evaluation blocks of every conditions. And then just
/jmp/'s to the needed block. In every block, if you put "break",
unconditional "jmp" is generated to the end of the whole switch-case
construction address. This seems efficient from the machine viewpoint.
If you don't put "break", consequently, there is no "jmp" is generated
and you get into the next (not your!) block (the next address after the
end of your block).
Is it design mistake? Or they couldn't do it better at the code
generation level? Don't know.
But why then, JS, being written at least in C (a high abstract language)
should borrow that "ugliness" because its "syntax-ancestor", C, have it
because its own problems?
That's why I like Coffee's/Ruby's switch-case better:
http://jashkenas.github.com/coffee-script/#switch
Explicit semicolon, you understand it, is also a
"syntactic-noise/garbage". It should be done by the machine, if needed
(if there is no new line terminator e.g.). In well-written ASI mechanism
(which is used in many languages) it plays a good role. I use of course
explicit semicolon in JS, but, juts as a habit mostly (a habit related
with concrete known issues of course). But I think, I wouldn't if there
were know that issues.
Yeah
There are many good scripting languages, yeah, every can be used for
"day-to-day" scripting. And writing of the own is a good programming
task: design and technical.
Dmitry.