News for hackers. Stuff that matters.
Re:Callback Hell (2016) by hashkb on Wednesday February 15, 2017 @10:44AM (#13652754)
Are there JS runtimes that are primarily synchronous? Certainly not any popular/widely used ones. Asynchrony is for all practical purposes a property of JS.
Re:Callback Hell (2016) by lucideer on Wednesday February 15, 2017 @12:41PM (#13653772)
Maybe not, but it's irrelevant. The point I was making is that the async features are platform APIs, they have no inherent attachment to the language.

And I personally think not knowing the distinction between the language and APIs provided to it is extremely limiting and misleading for someone approaching learning programming (it was for me, I wish this had been clearer to me earlier).

Re:Callback Hell (2016) by tyingq on Wednesday February 15, 2017 @01:57PM (#13654419)
>Maybe not, but it's irrelevant

I'm not sure it is. What's available, without custom work on your own, drives the ecosystem.

I can build an asynchronous application with PHP, but there's not much established practice, existing tools, shared learning and so forth. And, whatever I build that way is limited to an audience that will go out of their way to build my custom php interpreter.

Re:Callback Hell (2016) by Matthias247 on Thursday February 16, 2017 @05:13AM (#13658806)
You can run Javascript on the JVM with Rhino and Nashorn. There you have access to all the classical synchronous Java APIs - and you need to care about synchronization and real multithreading, which is not really javascripty.
Re:Callback Hell (2016) by tyingq on Wednesday February 15, 2017 @11:02AM (#13652932)
I'm not even sure there's an implementation that could do even the most common synchronous operation.

Like opening a socket, sending data, and blocking on the response.

Re:Callback Hell (2016) by cardiffspaceman on Wednesday February 15, 2017 @01:10PM (#13654019)
I'm not sure if you mean implementation of JS or of something that supports executing JS. If you start with the bare interpreter and add say, global functions, through the interpreter's extension API, they CAN be synchronous. You COULD produce a JS environment this way and run scripts in it. Your extensions could include synchronous usage of sockets. Your programs in this environment would be synchronous. Writing a decent web server in that environment would be a challenge.
Re:Callback Hell (2016) by tyingq on Wednesday February 15, 2017 @01:42PM (#13654291)
We're saying the same thing. The nature of the environment is slanted to async, thus, commonly available runtimes don't have much functionality that is synchronous.

You can find some of it, but it's the exception, not the rule.

Yes, you can build something specific, just as you can leverage async libraries in languages where it's not the common pattern.