Archive for the ‘ JavaScript ’ Category
Still following the philosophy of “what the hell are you still doing on my disk”, I released seethrough for JavaScript, a port of the XML/XHTML template engine I wrote for Erlang some time ago. [ READ MORE ]
Last time we saw how to transfer results of
computations from pseudo-blocking calls back into the main
process. What happens In the (real) synchronous world, error conditions used to
travel on the same road as return values:if when something goes wrong, though?
We've seen how to simulate a blocking sleep() in
JavaScript and what happens under the hood when we
do. Another scenario where a blocking call makes a big difference in
terms of clarity is requesting data from the network and suspending
execution until the answer arrives:
Let's review the process definition and process constructor from part 1:
(Update: a library based on this series is in use in SamePlace and is available here.) Here's something most languages can do which JavaScript can't (at
least when hosted in the browser):
In JavaScript that would be:
print("Going to bed...");
sleep(3000);
print("Sigh, I only slept three seconds.")