News for hackers. Stuff that matters.
Re:Why Not Document.write()? by user3939382 on Saturday April 01, 2023 @07:49PM (#35405459)
Hopefully with wasm, and combined with a new DOM at some point, we can have the situation on the web as we do with native code where we’re free to use any language we want. With fair competition I expect JS would slowly fade.
Re:Why Not Document.write()? by nightfly on Saturday April 01, 2023 @08:39PM (#35405799)
If people didn't like JS for itself Node.js wouldn't have been the success that it is
Re:Why Not Document.write()? by user3939382 on Saturday April 01, 2023 @09:51PM (#35406288)
This is a good point, though for the sake of discussion imagine that JS didn't exist, and had no ecosystem at the time Node came on the scene. Do you assume it would have been conceived for that purpose?

Arguably Node took off because it allowed an already-existing huge ecosystem of libraries, tools, and developers to be leveraged for the back end, with all of those resources in turn coming from the browser.

Re:Why Not Document.write()? by nightfly on Sunday April 02, 2023 @05:23AM (#35408690)
I'd argue that Node took off because it was a greenfield environment where nearly everything was encouraged to use the event loop for asynchronous programming, so everything worked nicely together
Re:Why Not Document.write()? by cxr on Sunday April 02, 2023 @09:26PM (#35417419)
> Node took off because it allowed an already-existing huge ecosystem of libraries, tools

It didn't. JS didn't have a huge set of existing tools and libraries when Node showed up. And the ones that did exist certainly didn't work in Node, considering they were written for the browser without a care in the world for other environments.

Re:Why Not Document.write()? by Bellend on Saturday April 01, 2023 @08:33PM (#35405757)
Do you see a new DOM being realistic? Not a sarky comment. I ask because I don't see the problem with a new <bellend> tag. Meaning that in 2023 browsers start having a html and a bellend tag representing an end to legacy and a line to the future.
Re:Why Not Document.write()? by user3939382 on Saturday April 01, 2023 @09:48PM (#35406274)
One silver lining of the otherwise (IMHO) mostly-bad situation we have with centralization of browsers is that it is conceivable through our standards groups that the major browser vendors agree to experiment with a replacement.

From my perspective the problem is even in the name itself, the D in DOM stands for document, which is exactly the problem. The DOM was never designed as an application framework but we've shoehorned it into that role.

Re:Why Not Document.write()? by holoduke on Sunday April 02, 2023 @02:15AM (#35407712)
Why is node so pupular serverside? I believe js is one of the easiest languages to step into. Its standard syntax is super easy to read. Its standard lib is very small. And it performs extremely good. The most performant scripting languages there is. Heavily optimized browser render engines and javascript executors helping with this. Nah. There is a reason why js is with us.
Re:Why Not Document.write()? by layer8 on Sunday April 02, 2023 @03:13AM (#35407998)
No, the sole reason why JS became popular server-side is because it’s the same language as used in the browser client-side. A large number of people started out learning programming in the browser, and having been “primed” with JS that way, it’s what they’re used to and then also want to use server-side.
Re:Why Not Document.write()? by Kiro on Sunday April 02, 2023 @05:01AM (#35408571)
> No, the sole reason

You can't possibly know that.

Re:Why Not Document.write()? by Timon3 on Sunday April 02, 2023 @07:06AM (#35409287)
The likelihood of a HN comment being correct is inversely proportional to its certainty.

I'm sure of it.

Re:Why Not Document.write()? by v3ss0n on Sunday April 02, 2023 @07:08AM (#35409298)
This , nobody liked JS on server side world before. Until node came in. And many people still hate JS even after year of serverside development. Especially who had done work with far sound languages like python and ruby on Django or RoR frameworks. There is no Quality framework for JS on that space even though many startups are using node as backend. Django Popularity rising back these days on hires .
Re:Why Not Document.write()? by veidelis on Sunday April 02, 2023 @03:38AM (#35408157)
One big reason I use JS on the backend is because Prisma can generate types for my API endpoints which I can use for my client code. Having confidence that my code works as expected is a huge deal and having end to end type safety is a great first step towards that.