43 lines
3.1 KiB
Plaintext
43 lines
3.1 KiB
Plaintext
|
|
Episode: 1389
|
||
|
|
Title: HPR1389: Javascript Corrections
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1389/hpr1389.mp3
|
||
|
|
Transcribed: 2025-10-18 00:40:25
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
Hmm.
|
||
|
|
Hello everyone, Sieg Flup here, Sieg Flups in a Slobble. You're listening to another episode
|
||
|
|
of Hacker Public Radio. And in this episode, we're going to have a few corrections. Yes,
|
||
|
|
that's right, corrections. The last episode of Hacker Public Radio, or the least the last
|
||
|
|
episode that I made was about JavaScript. And there are a few errors. Well, it was just
|
||
|
|
pretty much one error. I said it was the language of the future because of its concurrency. And
|
||
|
|
this isn't really the case. It's asynchronous, but it does run non-concurrently. How to explain
|
||
|
|
this is, I'll use no jasses in an example because it's uniform among platforms. And JavaScript
|
||
|
|
in browsers vary. One of what happens is blocks of code get executed. And they're putting
|
||
|
|
to a queue, a quote-unquote invent loop, if you like. But I like to call it a queue. And an
|
||
|
|
analogy for this queue is packages going through a scanner at an airport, where the scanner
|
||
|
|
executes. And the packages are what's created from reading lines of code, or blocks of code,
|
||
|
|
and the blocks of code are the people. So you have blocks of code, and you have what actually
|
||
|
|
does put into packages in the queue in the order at which it was executed. And they get put through
|
||
|
|
the scanner, which executes them. Synchronously, in a lot of the cases, but JavaScript is asynchronous.
|
||
|
|
Well, it's asynchronous when you have a block of code that requires. And I'll call a blocking
|
||
|
|
call, for instance, or some sort of network call, where you fetch a network object, like HTML,
|
||
|
|
HTML, XML, like an XML HTTP request, or something like that. What happens when you have something
|
||
|
|
like that is the package gets taken off the queue and gets run until whatever is blocking unblocks.
|
||
|
|
And then it gets put to the front of the queue, where it then calls a callback, for instance,
|
||
|
|
or some other code that it runs, typically a callback. So that's how it works. That's why,
|
||
|
|
if you have a spin lock on a variable, it actually brings JavaScript down to, it brings JavaScript
|
||
|
|
to halt, the interpreter to a halt. Because you're executing a block of code that doesn't allow the
|
||
|
|
queue to keep on moving. The package gets stuck in the scanner, if you will. And so that's the
|
||
|
|
correction I'd like to make. Thank you for listening, everyone, and happy hacking.
|
||
|
|
You have been listening to Hacker Public Radio, where Hacker Public Radio does our,
|
||
|
|
we are a community podcast network. The release is shows every weekday on day through Friday.
|
||
|
|
Today's show, like all our shows, was contributed by a HPR listener like yourself.
|
||
|
|
If you ever consider recording a podcast, then visit our website to find out how easy it really is.
|
||
|
|
Hacker Public Radio was founded by the digital.pound and the infonomicum computer club.
|
||
|
|
HPR is funded by the binary revolution at binref.com,
|
||
|
|
all binref projects are proudly sponsored by linear pages.
|
||
|
|
From shared hosting to custom private clouds, go to lunarpages.com for all your hosting needs.
|
||
|
|
Unless otherwise stasis, today's show is released under a creative commons,
|
||
|
|
attribution, share a like, lead us our license.
|