r/javascript • • Oct 29 '10

c# programmer: JavaScript is "completely single threaded and blocking" in relation to fetching from a URL.

/r/programming/comments/dxv7a/asynchrony_in_c_5_part_one/c13rj6k
0 Upvotes

26 comments sorted by

View all comments

21

u/ruinercollector Oct 29 '10

You are an idiot.

-12

u/Not_Edward_Bernays Oct 29 '10

no, I am still fucking right. the browser does not block while downloading data for AJAX. that's what I said, that's what you all have confirmed. what they are trying to achieve in that C# example is something javascript in the browser does without any weird code. so it is exactly as I characterized it, especially in this example, they are trying to catch up with javascript.

I never said the UI code runs on multiple threads.

if I could have less respect or more animosity towards you pieces of shit I would.

9

u/awgy Oct 29 '10

if I could have less respect or more animosity towards you pieces of shit I would.

I believe the feeling's mutual.

8

u/ruinercollector Oct 29 '10

what they are trying to achieve in that C# example is something javascript in the browser does without any weird code

Not at all. C# has supported the handling asynchronous calls by providing callbacks since 1.0, and it's supported doing so through closures since 2.0.

What is outlined in this example for 5.0 is not at all possible in javascript. You completely missed the point of the video.

5

u/darrenkopp Oct 29 '10

I take it you haven't heard of BeginInvoke and EndInvoke?

Action a = new Action(() => {
    // some blocking operation
});

// run async, invokes callback when done
a.BeginInvoke(cb => a.EndInvoke(cb), null);

This is no different than the javascript example. You start something executing, and when it's done, it calls a callback. In javascript, the callback is the onreadystatechange callback. They are the exact same in principal, just different in execution.

Also, XmlHttpRequest does not mean asynchronous, it just is by default. you can have a blocking XHR request.

-1

u/Not_Edward_Bernays Oct 29 '10

I did a lot of async programming with begininvoke and such 3 or so years back

7

u/franksvalli Oct 29 '10

Man, you have to realize after a while that even though you may have some valid points (XHR can be either asynchronous or synchronous, and Web Workers run on separate threads, etc), NO ONE is going to want to talk to you or side with you with when you have such a piss poor attitude. Think of a crazy man yelling on the street corner, repeating "THE EARTH IS ROUND, MOTHERFUCKERS!". It doesn't matter how correct the person is.. if the message is being delivered in such a crazy way, no one is going to want to listen or interact with you.

This is just how things are, and eventually you're going to have to realize, if even to keep a stable job, that you have to at least APPEAR to be a normal person.

(as a side note, there's definitely a bad side to this - people dressed up with a confident air are more likely to be believed, regardless of the content of their message. That's why there's so many cocksure people who rise so fast in the business world.)

3

u/octatone Oct 29 '10

LOL WHY YOU MAD THO