If I were to hazard a guess, I would say that it is because the compiler cannot tell when it would be more optimal to break out your strings into variables and concatenate them. (And, as such things go, it falls under the heading of micro-optimization in the first place.)
For example, the following code:
if (test_case==="He fell down a well") {
var i=my_object_array.length-1;
while(i>=0) {
my_object_array[i].say("He fell down a well did he Lassie?");
i--;
}
}
Might be re-rendered by your theoretical compiler as:
var x="He fell down a well";
if (a===x) {
var i=b.length-1;
while(i>=0) {
b[i].say(x+" did he Lassie?");
i--;
}
}
... which would of course, increase the time it takes for the while
loop to complete its work.
Of course, a slightly more intelligent compiler might recognize that trap and optimize still further:
var x="He fell down a well";
var x1=x+" did he Lassie?";
if (a===x) {
var i=b.length-1;
while(i>=0) {
b[i].say(x1);
i--;
}
}
Either way though, a good javascript compiler, to my mind, optimizes the code first for performance, and only secondarily for character count. As this is an optimization primarily for character count improvement I think that there probably simply has not been enough demand for it to warrant the time of the people who maintain Closure and the YUI Compressor.