B
Ben Kolera
As far as AJAX is concerned, I am not so concerned about the concurrent
data access problems (dining philosphers, anyone?) inherent to
multithreaded programming, but am worried, rather, about the sheer lack
of documentation detailing the behaviour of javascript in such
situations.
For example, if I have two XMLHttp objects, for which I need both
loaded to continue processing:
var XMLHttp1 = XMLHttpRequest();
var XMLHttp2 = XMLHttpRequest();
xmlHttp1.onreadystatechange= handle;
xmlHttp2.onreadystatechange= handle;
.... //snip code for sending the request
function handle() {
if(xmlHttp1.readyState == 4 && xmlHttp2.readyState == 4) {
... // snip code for continuing the processing of data
}
}
If this code was written in Java, then this code would be unsafe but I
haven't a clue as far as javascript is concerned. What constitutes as
an atomic instruction in javascript? The scary thing about it is that
it may well be very interpreter dependent... I haven't yet read the
specs for E4X, but I hope that it specifies some form of consistent
concurrency behaviour and that the browser vendors actually pay close
attention to it.
It's a problem with javascript in general, imho. I have no problems
with wonderfully abstract and expressive high level scripting languages
(big fan of Scheme ) but I despise all of these "magical" and quirky
undocumented behaviours that you see in languages like Javascript and
(worse still) Flash Actionscript (lol). I like to know exactly what is
going on, even if I have to read a ridiculously abstract and poorly
maintained documentation that I have to venture into dark, neglected
places of the ECMA website to find.
I realise that there is a simple way to get around this (just load them
one after the other! [since they are dependent upon each other anyway]
*gasp* how un ajax of me... i thought the goal of AJAX was to kill
browsers by opening as many threads and http connections as possible,
lol) but it just annoyed me that I had no idea of what was really going
on. I thought that I would pose the question to see if anyone knew.
data access problems (dining philosphers, anyone?) inherent to
multithreaded programming, but am worried, rather, about the sheer lack
of documentation detailing the behaviour of javascript in such
situations.
For example, if I have two XMLHttp objects, for which I need both
loaded to continue processing:
var XMLHttp1 = XMLHttpRequest();
var XMLHttp2 = XMLHttpRequest();
xmlHttp1.onreadystatechange= handle;
xmlHttp2.onreadystatechange= handle;
.... //snip code for sending the request
function handle() {
if(xmlHttp1.readyState == 4 && xmlHttp2.readyState == 4) {
... // snip code for continuing the processing of data
}
}
If this code was written in Java, then this code would be unsafe but I
haven't a clue as far as javascript is concerned. What constitutes as
an atomic instruction in javascript? The scary thing about it is that
it may well be very interpreter dependent... I haven't yet read the
specs for E4X, but I hope that it specifies some form of consistent
concurrency behaviour and that the browser vendors actually pay close
attention to it.
It's a problem with javascript in general, imho. I have no problems
with wonderfully abstract and expressive high level scripting languages
(big fan of Scheme ) but I despise all of these "magical" and quirky
undocumented behaviours that you see in languages like Javascript and
(worse still) Flash Actionscript (lol). I like to know exactly what is
going on, even if I have to read a ridiculously abstract and poorly
maintained documentation that I have to venture into dark, neglected
places of the ECMA website to find.
I realise that there is a simple way to get around this (just load them
one after the other! [since they are dependent upon each other anyway]
*gasp* how un ajax of me... i thought the goal of AJAX was to kill
browsers by opening as many threads and http connections as possible,
lol) but it just annoyed me that I had no idea of what was really going
on. I thought that I would pose the question to see if anyone knew.