Re: [ClojureScript] Re: basic conceptual question: clojurescript & core.async

2016-08-08 Thread Brian Beckman
On Monday, August 8, 2016 at 6:30:14 AM UTC-7, Moe Aboulkheir wrote:
> By no means is it typical that in a JS runtime, external interactions (I/O) 
> would block the execution thread - if that were the case, the callbacks would 
> not be necessary.
> 
> 
> Take care,
> Moe

Let's see whether I understand: The code running on the JavaScript main thread 
(call it A) makes a non-blocking call to a service (say I/O, call its code B) 
and passes in a callback C written by me. The call to B returns immediately and 
my main JavaScript code A continues doing whatever it was doing (say servicing 
the user interface). The callback code C executes on _another_ thread, a thread 
under control of the B. I write code A and I write code C, but my code A runs 
on the JavaScript main thread and my code C runs on some other thread. Is that 
right?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


[ClojureScript] Re: basic conceptual question: clojurescript & core.async

2016-08-08 Thread Brian Beckman
The quote puzzles me. I would be less puzzled if it said "... turns the 
Asynchronous-looking channel reads and write into Synchronous calls."

I don't understand the source of asynchrony in single-threaded JavaScript. I 
can see that a go block can implement something equivalent to an iterator via a 
state machine and queues, so a data-producer and a data-consumer can have the 
illusion of asynchrony while executing on a single thread. I can see that 
JavaScript may interact with external software by blocking the JavaScript 
thread and by responding through callbacks that run on the JavaScript thread. 
Those callbacks could implement the channel abstraction of clojure.async. Am I 
missing some other kinds of interaction? Have I got an accurate or inaccurate 
picture of what's going on in JavaScript?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


[ClojureScript] basic conceptual question: clojurescript & core.async

2016-08-07 Thread Brian Beckman
If JavaScript is single-threaded, and ClojureScript compiles to JavaScript, how 
does core.async make sense in JavaScript?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.