News for hackers. Stuff that matters.
Re:Single Page Applications using Rust by pedrocr on Tuesday August 11, 2020 @10:48AM (#24120817)
We're finally getting back to this point where you can choose whatever language you want to program for the web. It only took us 15 years of being flamed every time you pointed out you didn't like Javascript but were forced to use it to be part of the modern web. One of the motivations for Viaweb was being able to do Lisp, hopefully this gets the web back to that mindset of only the behavior mattering and whatever language you want to use go for it.
Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @11:28AM (#24121341)
It's ironic because this is only possible due to the continued development of sophisticated web tooling, which is the biggest complaint made by people who complain about the state of web development.
Re:Single Page Applications using Rust by bitexploder on Tuesday August 11, 2020 @11:48AM (#24121640)
The tools are sophisticated but also much harder to use. Things like modern front end JavaScript and Kubernetes are very complex beasts to tame. Their value is dubious for many use cases people choose them for, but they are undeniably powerful tools that advance the state of art by a lot. Same with NoSQL. It became hyped and overused but some really powerful and easier to use technology eventually emerged from it and gave us things like Redis, Redis now is a part of most modern web app stacks. I still just use Django and a lot of server side HTML templates. Developers often have a hard time knowing when to use a given technology and often end up bringing tech into their stack they don’t need. This plays out in 5-8 year cycles. Meanwhile RDBMS and simple things like Django with minimal front end JavaScript can still solve the vast majority of problems people have in the web app space. It’s the classic hype/adoption/cynicism cycle we have had forever.
Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @11:59AM (#24121813)
This just reads to me like "my personal preferences are good and things I don't like are hyped up and of dubious merit".

If it were me, I'd prefer rails to django any day of the week, that's a personal preference, but if we're talking about building an SPA you're typically going to be building a worse solution if you can't SSR your client views, which you need a js backend to do.

Re:Single Page Applications using Rust by setr on Tuesday August 11, 2020 @12:54PM (#24122532)
I've never been fully confident in knowing what SSR refers to -- but its just the creation of static html on the server, right? As opposed to shipping a bunch of async dom updates contained in a js script executing on load, client side

But if I have it right, I have no idea why a JS backend would be required to do SSR; this is exactly the same domain of work php, rails, django have always done, without node.js needing to enter. For an SPA (which I believe is just a bunch of js fetching data from JSON apis and rendering client-side), you'd need JS to handle client-side rendering, but if you can replace that with WASM (when it has DOM support)... I don't see why you'd need JS anywhere

FYI I'm defining everything because I'm pretty sure there's a mistake somewhere in my understanding of the problem

Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @01:05PM (#24122697)
Nah it's used in two related, but kinda confusing ways, it's not just you:

Traditionally, it means rendering your HTML on the server. Exactly what you're saying.

It also refers to a specific technique that's used to implement rendering your HTML on the server by effectively running your client side app server side, then shipping its output. This requires some work to get right, and so it's presented as a feature of client-side libraries/frameworks.

Re:Single Page Applications using Rust by setr on Tuesday August 11, 2020 @01:35PM (#24123125)
Ah

The actual client code is being executed.

Wait thats just weird -- if you're effectively removing the work from the client to the server anyways, such that its only executing on the server... I don't see what you've achieved beyond the original writing of standard language-agnostic SSR -- that you can design everything client-side, and conveniently migrate the heavier work serverside without interruption/rewrite?

Re:Single Page Applications using Rust by nwienert on Tuesday August 11, 2020 @02:17PM (#24123725)
It gives you the best of both worlds - fast initial load, accessible, works without JS. But then also get all the client side goodness - highly interactive views, animations, and far less bytes transferred for subsequent page loads. Plus, writing a complex frontend is simply a far better experience in something like React than in Ruby, Python, PHP, etc.

Finally, it lets you also render them to React Native using a lot of shared code. And you can share code between your backend APIs, etc.

To be honest, I’ll take Typescript over anything, even if it wasn’t the default for the web. It strikes the perfect balance of flexibility, concision, safety, debugging ux, and has a huge ecosystem to boot. I think client side JS these days if anything is underrated and the WASM hype won’t change much - if you want a lightweight, accessible app then doing a SPA in JS (with SSR) is actually not even a compromise, it’s truly superior to any alternative. Now, with a big caveat: you need to invest to get it all set up properly. No one has really “railsed” it yet, as far as I can tell.

Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @01:44PM (#24123296)
> such that its only executing on the server

It's not, it can run on both. You render on the server for the initial page load, and then on the client for every page after.

Or not! The point is, now that you've unlocked both, you can use either one, in the way that works best for your application, in whatever ratio makes sense.

Re:Single Page Applications using Rust by andyfleming on Tuesday August 11, 2020 @11:33PM (#24128368)
A significant consideration here is SEO and crawlability. Rendering the page server-side will serve a page with content even without JavaScript running on the client, yet for clients that do have JavaScript they still get the enhancements of an interactive JavaScript app.
Re:Single Page Applications using Rust by vmarsy on Tuesday August 11, 2020 @02:23PM (#24123834)
> I've never been fully confident in knowing what SSR refers to

https://developers.google.com/web/updates/2019/02/rendering-... is a great resource on the subject.

You can be fully Server-side (regular php), you can do full JS client-side rendering, and you can have hybrids that mix both.

Re:Single Page Applications using Rust by kristiandupont on Tuesday August 11, 2020 @01:06PM (#24122707)
SSR typically refers to server side rendering of a single page app. I.e. render the HTML for a given route of an SPA. For that to work, you need to be able to execute your SPA code on the server which will be JS. You are right that WASM will change all of this, but the ecosystem is not mature yet.
Re:Single Page Applications using Rust by bitexploder on Tuesday August 11, 2020 @04:21PM (#24125513)
To some extent, that is true regarding my personal preferences, but being in tech and writing code for over 20 years teaches you a few things. Developers should be more picky about tools they adopt without becoming too cynical or dismissive of new technology. Every so often you have to go through your technology shed and be sure you aren't being biased towards existing comfortable tools. It's nice to work out of your comfort zone and learn new things, but it's also nice to be very efficient at problem solving. When I feel a new tool or technology crosses a threshold from hype to having proved its value I tend to take it seriously and learn it. I try to avoid getting sucked into tech stacks that I don't think will make it. Some times I am wrong, but usually not. I could have made my description of technology more generic, but in general, things like Django/Rails/Postgres/MySQL/NodeJS/Redis are battle proven technology that won't let you down. IMO that is the hardest part about being a lead engineer / CTO -- knowing when to say Yes and No to given technology stacks :)
Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @06:02PM (#24126550)
I agree with everything you've written here, particularly your process of tool evaluation and refinement. My only push back is with respect to the way you characterized the merit of "overhyped" tools (in your previous comment) that didn't line up with the productivity profile of your personal experience. I agree that Django/Rails/Postgres/MySQL/NodeJS/Redis are all reliable tools, but I am not a fan of the philosophy that labels other people's work as unnecessary or harmful simply for existing outside the pantheon of worthy tooling.
Re:Single Page Applications using Rust by bitexploder on Wednesday August 12, 2020 @09:32AM (#24131890)
In isolation of any constraint new things are always worth playing with and trying. I know I am certainly more biased (hopefully in a mostly good way) now than I was when I started in tech. Your thought strikes me as Very similar to when someone shares some hobby project they are working on and someone else doesn’t get it and states: “wow, you must have a lot of time on your hands”. So I do try to take new projects seriously while at the same time balancing time constraints. It’s hard :)
Re:Single Page Applications using Rust by airstrike on Tuesday August 11, 2020 @12:56PM (#24122562)
> If it were me, I'd prefer rails to django any day of the week, that's a personal preference

This is totally not what the parent is getting into. It seems like your comment reads much more like "my personal preferences are good" than the parent

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @01:06PM (#24122710)
They complain about Javascript and Kubernetes then praise Django and Redis, all in the abstract without any consideration for the totally different problems these tools actually solve. I injected my own personal preferences in-kind but labeled them as preferences instead of slamming other tools as overhyped and without merit.
Re:Single Page Applications using Rust by there_the_and on Tuesday August 11, 2020 @01:05PM (#24122701)
> if we're talking about building an SPA you're typically going to be building a worse solution if you can't SSR your client views, which you need a js backend to do.

I have not used React with Rails and maybe I'm misunderstanding your comment, but the react-rails readme includes a section about SSR via ExecJS and integrated with Rails:

https://github.com/reactjs/react-rails#server-side-rendering

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @01:12PM (#24122785)
ExecJS functions as a JS backend in this case, its just a ruby interface for node/rhino/v8 that's a little bit clunkier to utilize.
Re:Single Page Applications using Rust by there_the_and on Tuesday August 11, 2020 @01:13PM (#24122801)
That is obvious (it's in the name). The way your comment is phrased reads to me like you are saying that one can't use Rails and has to switch to a full JS backend for SSR. If that's not what you are saying, then it's unclear what you are actually saying and why you juxtaposed Rails / Django against a JS backend.
Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @01:39PM (#24123194)
My point is that you literally cannot SSR your client js views without a js backend, so node has a clear engineering purpose in this respect. Yes, you can import a second backend into your main backend to avoid writing node, and that's fine, maybe your team is mostly made of rubyists or maybe your existing code base is ruby, there's nothing wrong with this approach, but it is more complication and layers of abstraction than just using a js backend if you must build an SPA.
Re:Single Page Applications using Rust by there_the_and on Tuesday August 11, 2020 @01:55PM (#24123447)
> import a second backend into your main backend

This is not typically how the term "backend" is used in this context. Most mature apps will use a variety of tools and services built in a variety of languages, but this is not referred to as "importing a second backend." In fact, your comment is apparently the first use of the phrase "import a second backend" on the entire internet: https://www.google.com/search?q=%22import+a+second+backend%2...

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @02:33PM (#24123989)
I'm speaking metaphorically. When I say "import a second backend" I'm saying that the thing being imported into the ruby backend is literally a wrapper around the exact same runtime that is typically used to run js backends, the corollary being that the "ruby" part is unnecessary added complexity from an engineering perspective unless you have some other compelling reason to use ruby (which is certainly possible).
Re:Single Page Applications using Rust by Scarbutt on Tuesday August 11, 2020 @12:37PM (#24122308)
but if we're talking about building an SPA you're typically going to be building a worse solution if you can't SSR your client views

Is not worse, is fine. Mostly depends on the requirements, why go the extra complexity of SSR if you don't need it?

Re:Single Page Applications using Rust by putnambr on Tuesday August 11, 2020 @12:46PM (#24122415)
Most of the time SSR gives massive web accessibility benefits. Ignoring web accessibility because you don't want to implement SSR is likely a worse solution for a large portion of your userbase.
Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @12:48PM (#24122439)
That's why I said "typically". One of the biggest complaints about SPAs is the perceived slowness due to the app loading and rendering assets in the browser, as well as the typical HN noscript complaints, as well as accessibility issues, SEO issues, and other problems related to back button behavior and url routing. SSR solves all of these troubles.
Re:Single Page Applications using Rust by wtetzner on Tuesday August 11, 2020 @01:02PM (#24122654)
I'm not sure exactly what you're referring to, but being able to run Rust both on the server and client should allow SSR, no?
Re:Single Page Applications using Rust by learc83 on Tuesday August 11, 2020 @11:35AM (#24121465)
People complaining about that are generally talking about the churn in front end web frameworks and JavaScript development in general.

None of that eas necessary for WebAssembly to be developed. Unless you mean that the annoyance of the constantly changing JS ecosystem motivated people to push for it.

Re:Single Page Applications using Rust by tbugrara on Tuesday August 11, 2020 @01:54PM (#24123432)
It's 2020 and I still see this "churn in frontend web frameworks" mentioned. I don't see how this is true anymore. The churn was very real in the early 2010s, but these days almost all web development is done in React [1]. If not React, it's either Vue, Angular, and Ember. I'm sure there are a lot of niche frameworks out there that are in use, but that's not what churn means. As a web developer you can learn React once and never have to pick up another framework again pretty easily.

Not to mention that at this point the complexity of web development isn't exclusively held within your framework choice. Thinking about global state, eventing, and architecting your project are where the real hard problems are.

[1] https://2019.stateofjs.com/front-end-frameworks/#front_end_f...

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @11:45AM (#24121595)
Nobody wants to hand-write wasm, you need a tooling pipeline to make that type of development workflow practical, its not any different from babel or typescript in this respect; using rust instead of js is "churn" just as much as any of the other options available for building web pages that you don't have to use.
Re:Single Page Applications using Rust by learc83 on Tuesday August 11, 2020 @12:00PM (#24121823)
>Nobody wants to hand-write wasm, you need a tooling pipeline to make that type of development workflow practical,

Yes and nothing about the Babel or typescript or node was required for the creation of wasm or a wasm compiler.

People complain about churn in the JS ecosystem because of the rate that frameworks and tooling rise and then fall out of favor.

I don't see the irony at all in people complaining about one ecosystem while being excited that they are being given a way to bypass that ecosystem all together.

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @12:13PM (#24122009)
> People complain about churn in the JS ecosystem because of the rate that frameworks and tooling rise and then fall out of favor.

And building web pages with rust is just another example of this phenomenon, its ironic because somehow its viewed as a positive thing by people who commonly complain about the introduction of new tools into web development ecosystem, but the power of rust hype somehow obscures the fact that this is exactly the same thing such detractors always complain about.

For the record, I love rust and wasm and think this is great, but I have always been opposed to the framing that people creating new web development tools is a bad thing.

Re:Single Page Applications using Rust by learc83 on Tuesday August 11, 2020 @12:56PM (#24122557)
People complain that the JavaScript ecosystem changes too frequently.

It is perfectly logical to believe that this is true, while simultaneously believing that allowing new language ecosystems to target the browser, could result in a new ecosystem that is much more conservative and changes at a slower pace than the JS ecosystem for whatever reason (a language with a larger standard library, a language with a different culture etc...).

A one time change to another ecosystem and then a slower pace of changes.

Who knows if this is will be the case, but it is a logically consistent position to hold, and there's nothing ironic about it.

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @01:00PM (#24122620)
It's not logically consistent. Why does it matter whether the tooling compiles down to js or wasm, if anything, expanding the web development ecosystem to include dozens of new languages and frameworks will increase "churn" as many new approaches become popularized on the front-page of HN. It's absolutely no different than a new js framework.
Re:Single Page Applications using Rust by learc83 on Thursday August 13, 2020 @10:18AM (#24143561)
That depends on the scope of what you're looking at. Instead of looking at webdev as a whole, if you're just looking at individual ecosystems then while global churn may increase, it's entirely possible that you could move into an ecosystem with a lower level of churn.

It's perfectly logical to criticize the JavaScript ecosystem for having too much churn, while calling for a change that will increase Global web development churn, while simultaneously creating another subset of the global ecosystem with a locally lower level of churn--assuming you are only planning on working in that particular ecosystem.

Re:Single Page Applications using Rust by root_axis on Thursday August 13, 2020 @02:02PM (#24146197)
It's not logical, it doesn't matter if the source code is javascript or not, if it compiles down to js or wasm it is definitionally equivalent to "js churn" because it represents an additional option in the js tooling landscape that a developer has the option of choosing from, rust is no different from typescript or purescript or babel or elm or any of the other variety of options available for producing web applications.

If you're suggesting otherwise, you'd have to explain what exactly is bad about churn in general and why those negative properties somehow dissipate based on the source language. Using your logic if every tool in the existing js landscape compiled down to wasm somehow "churn" would be a non-issue, but if that's the case then "churn" must mean something different than what is regularly complained about on every js technology thread on this forum.

Re:Single Page Applications using Rust by learc83 on Thursday August 13, 2020 @04:24PM (#24148366)
You seem to be deliberately missing any point I'm making. I think it's because you've dug yourself in and you're more concerned about winning an argument than in what I'm saying.

But here goes.

First, I don't care about churn--doesn't bother me. It does bother a lot of people though.

Imagine there's a console called a ChurnBox. ChurnBox only runs code written in Churn. The Churn ecosystem is known for adopting and then abandoning frameworks at a rapid pace. People who run Churn teams have a reputation for for quickly adopting the newest Churn framework of the moment.

Now you are a developer who wants to work on the ChurnBox, but you absolutely despise learning new frameworks.

You could try to find a company that uses Churn with no frameworks, but you're a bit lazy and it's hard to find that kind of thing out just from reading job advertisements, so you stick with your old trust language--Molasses.

Molasses is known for its very expansive standard library and its very slow release cycle. The community is also very conservative, so most Molasses developers stick with the standard library and new frameworks are rarely released.

One day the company that makes ChurnBox announces that they are going to run code written in a low level language called Chasm that is designed to be easy to compile to.

Then some of the Molasses maintainers announce that they are releasing a Molasses to Chasm compiler.

You're excited because you think that maybe in the future you can completely ignore the Churn ecosystem, but still get to write programs for the Churnbox. You think that maybe in the future you'll be able to easily find Molasses Churnbox shops to work with that will adopt the conventions of the existing Molasses ecosystem, and thus rarely adopt new frameworks.

Re:Single Page Applications using Rust by root_axis on Thursday August 13, 2020 @08:45PM (#24151854)
> You seem to be deliberately missing any point I'm making. I think it's because you've dug yourself in and you're more concerned about winning an argument than in what I'm saying.

I think you're just too condescending to fathom someone disagreeing with you.

> Imagine there's a console called a ChurnBox. ChurnBox only runs code written in Churn. The Churn ecosystem is known for adopting and then abandoning frameworks at a rapid pace.

Totally irrelevant. Pick a framework and use it, there is nothing preventing you from doing this regardless of the language; that's an indisputable fact. If you feel compelled to make engineering decisions based on superficial fashions rather than as an answer to specific needs, that's your mistake, it has nothing to do with the language or the framework.

> One day the company that makes ChurnBox announces that they are going to run code written in a low level language called Chasm that is designed to be easy to compile to.

Absolutely nothing has changed, that's exactly how all modern JS tooling works today! In fact, almost every language out there has some type of lang-to-js project, the only thing that makes WASM special is the memory and performance capabilities that cannot be achieved with vanilla js, however the "too much churn" crowd are usually quick to point out that low-level performance is almost always complete overkill for a web application.

> Now you are a developer who wants to work on the ChurnBox, but you absolutely despise learning new frameworks.

WASM presents you with the exact same problem because you now have to learn a new framework that models your applications with respect to a browser environment. 99% of JS frameworks from the last two decades continue to work today, so the only reason you would ever upgrade to something different is because you have a specific need that justifies the upgrade or you are the very thing that you're complaining about and rely on the slow pace of Molasses to prevent you from refactoring your production applications every time someone's personal project hits the front-page of HN.

Re:Single Page Applications using Rust by learc83 on Thursday August 13, 2020 @10:02PM (#24152348)
>I think you're just too condescending to fathom someone disagreeing with you.

Kick rocks.

>Totally irrelevant. Pick a framework and use it, there is nothing preventing you from doing this regardless of the language; that's an indisputable fact. If you feel compelled to make engineering decisions based on superficial fashions rather than as an answer to specific needs, that's your mistake, it has nothing to do with the language or the framework.

First engineering decisions are often based on superficial fashions because fashion influence executives, investors, engineering leadership, and available talent.

Second I wasn't talking engineering decisions, but career decisions relating to potential work environment.

Third those aren't the decisions I would make, but I can understand how someone would arrive at them logically.

>Absolutely nothing has changed, that's exactly how all modern JS tooling works today! In fact, almost every language out there has some type of lang-to-js project, the only thing that makes WASM special is the memory and performance capabilities that cannot be achieved with vanilla js, however the "too much churn" crowd are usually quick to point out that low-level performance is almost always complete overkill for a web application.

So wasm is no better than JS, and it isn't a better compilation target. Except where it is better. But that's irrelevant because the straw men you're conjuring don't think that part matters. Gotcha.

It doesn't matter if wasm is actually a better compilation target (I think that it is) because it is perceived to be a better target, and is attracting interest in places that compiling to JS didn't (Blazor for one).

>99% of JS frameworks from the last two decades continue to work today, so the only reason you would ever upgrade to something different is because you have a specific need that justifies the upgrade

If you're talking about personal projects, sure. I don't know anyone who is concerned that they might have to switch frameworks for their personal projects. The concern is rapid adoption and abandonment of frameworks within potential employers.

Re:Single Page Applications using Rust by root_axis on Thursday August 13, 2020 @11:36PM (#24153012)
> First engineering decisions are often based on superficial fashions because fashion influence executives, investors, engineering leadership, and available talent.

Executives and investors aren't hip to the latest software engineering trends, and even if they are, it's not at all common that non-technical executives are asking engineers to rewrite the business in a new framework, this is pretty much never what they want, even in the rare case when that's actually a good idea.

As far as engineering leadership goes, if they're rewriting the business based on technology fashion they're simply a terrible engineering leader and that is the consensus opinion within the industry.

Finally, the talent pool argument just doesn't square with reality; the JS talent pool is one of the most robust in existence, the idea that businesses are having trouble hiring engineers because their JS frameworks are going out of date is fiction.

> So wasm is no better than JS, and it isn't a better compilation target. Except where it is better. But that's irrelevant because the straw men you're conjuring don't think that part matters. Gotcha.

Wow. That's a very disingenuous twisting of what I wrote. It's not a starwman, it's an extremely common criticism of the js ecosystem, i.e. that it has too much complexity and that all these fancy tools don't contribute much of anything useful except fluff for cowboy programmers to pad their resumes. The use of the word "churn" implies that nothing useful is gained, otherwise it's not "churn" it's "progress" and something to be lauded rather than looked down on.

> The concern is rapid adoption and abandonment of frameworks within potential employers.

Right... so potential employers who want to build front-end web applications have an overflowing arsenal of battle-tested front-end tooling in the JS ecosystem and now WASM comes along and offers an exponential increase of nascent front-end tooling options, yet somehow you can't connect the dots between why the introduction of these tools in the WASM ecosystem produces EXACTLY the same effect as it does when new tools are introduced into the JS ecosystem. How long before we start to see "Why we rebuilt our front-end in Rust/Ruby/Go/Haskell etc" blogs hitting the front-page? It's exactly the same damn thing.

Re:Single Page Applications using Rust by learc83 on Friday August 14, 2020 @11:49AM (#24159471)
>Executives and investors aren't hip to the latest software engineering trends, and even if they are, it's not at all common that non-technical executives are asking engineers to rewrite the business in a new framework, this is pretty much never what they want, even in the rare case when that's actually a good idea.

>As far as engineering leadership goes, if they're rewriting the business based on technology fashion they're simply a terrible engineering leader and that is the consensus opinion within the industry.

Yes this is basically always a bad idea. That it's a bad idea and doing it makes you a bad executive/leader/whatever doesn't stop it from happening.

>Finally, the talent pool argument just doesn't square with reality; the JS talent pool is one of the most robust in existence, the idea that businesses are having trouble hiring engineers because their JS frameworks are going out of date is fiction.

You can always find candidates. Whether you can find candidates in your particular locations, for the price your company is willing to pay, that don't require more training or ramp up time learning your framework than your company is willing to privde is another story entirely.

>Wow. That's a very disingenuous twisting of what I wrote. It's not a starwman, it's an extremely common criticism of the js ecosystem, i.e. that it has too much complexity and that all these fancy tools don't contribute much of anything useful except fluff for cowboy programmers to pad their resumes. The use of the word "churn" implies that nothing useful is gained, otherwise it's not "churn" it's "progress" and something to be lauded rather than looked down on.

You aren't the one making the argument, you are picking the version of the argument that fits your argument.

One of the biggest arguments for using vanilla JS is performance, and there are plenty of people arguing against churn and for performance. But you dismissed the performance advantage by saying that people arguing against churn don't care about low level performance.

>"Why we rebuilt our front-end in Rust/Ruby/Go/Haskell etc" blogs hitting the front-page? It's exactly the same damn thing.

I'm sure that will happen.

The difference is that if you decide to work for a C# shop doing Blazor development, they are less likely to switch their company over to Ruby, than a JS shop is to switch to a new framework or introduce new tooling.

If that sounds good to you, then it makes sense to simultaneously dislike the state of the JS ecosystem, yet like the introduction of wasm.

Re:Single Page Applications using Rust by FridgeSeal on Wednesday August 12, 2020 @05:37AM (#24130080)
Not being JS, and therefore not having to deal with all the traps that it contains is a pretty big point of difference.

It also provides a boost to other languages, which I think is good, there's no really good reason why JS should continue to be the only browser 'blessed' language.

Re:Single Page Applications using Rust by root_axis on Thursday August 13, 2020 @02:08PM (#24146272)
> therefore not having to deal with all the traps that it contains is a pretty big point of difference.

The primary complaint expressed regarding front-end churn is that the landscape is confusing because there is too much tooling and too many options and that they're unnecessary and that people should just use JS, if you're saying "not having to deal" with js is a positive thing then you're implicitly saying "churn" is not a problem since "not having to deal with js" is the only reason that "churn" exists in the first place.

Either "churn" is bad and something like rust-to-web is another example of unnecessary tools complicating the landscape or tooling that helps to avoid the warts of js is a good thing and "churn" is a non-issue; you can't have it both ways.

Re:Single Page Applications using Rust by emsy on Tuesday August 11, 2020 @12:27PM (#24122171)
The problem is not creating new web development tools but creating them for the sake of creating them. And what’s worse is people end up using them out of fear to fall behind. People complained about Maven that you first have to „download the internet“ to run a build. This is even more true for npm. In the meantime there are still native apps written in C and makefiles that work just fine. Also, wasm is just a new compilation target for Rust. This means if you know Rust you can write web apps. You have to learn less. With a new tool you have to learn usage, syntax and idiosyncrasies.
Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @12:35PM (#24122288)
> The problem is not creating new web development tools but creating them for the sake of creating them.

Why is that a problem and who is the arbiter of merit with regard to publishing code to the internet? I can't see any other way to parse what you've written other than "people should stop making so much stuff"

> wasm is just a new compilation target for Rust

And the vast majority of the js ecosystem is just compilation targets for js, if anything rust seems even further removed from the web ecosystem since web applications typically don't require low level performance.

Re:Single Page Applications using Rust by danShumway on Tuesday August 11, 2020 @12:34PM (#24122279)
Agreed. I'm also completely onboard with what Rust is doing here. Language choice is fantastic, I think opening up the web to multiple programming languages is going to be very good for the web as an ecosystem.

But at the same time --

To all the people complaining that modern web browsers are too complicated for small teams to build and maintain, do you think WASM helped with that at all?

To all the people complaining that Javascript's lack of an extensive standard library makes it hard to quickly read/grok other people's code on Github, do you think that situation is going to get any better when people are using entirely separate languages to program the same webapps?

To all the people complaining that there are too many frameworks and tools being released for the web to keep up with, do you think that's going to get any better when suddenly every programmer and their dog can start porting any Open Source UI toolkit/framework to the web with low-cost DOM bindings?

Re:Single Page Applications using Rust by Risord on Tuesday August 11, 2020 @02:49PM (#24124254)
> To all the people complaining that modern web browsers are too complicated for small teams to build and maintain, do you think WASM helped with that at all?

Kind of yes.

For simple browser as a general application platform you need a simple base technology where much can be shipped as library level. It would be fun to see WASM only browser with JS and CSS layouting solutions run as WASM compiled libraries.

So in theory WASM could be used as a first step to more simple browser but in practise it's propably just a fantasy.

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @12:43PM (#24122374)
> To all the people complaining that modern web browsers are too complicated for small teams to build and maintain, do you think WASM helped with that at all

Absolutley not. I love rust and would be happy to live in a world where I could write rust in any place where I would typically use typescript or babel or coffeescript back in the day, but none of that is going to be possible without an entire stack of tooling similar to that which already exists for the js-targeted ecosystem, and I have no problem with that, but people who ostensibly dislike "churn" claim to have a problem with new tooling and new solutions for building web pages and this is exactly the promise of wasm.

If anything, wasm represents the biggest shift in "churn" in the history of web development since it opens the door to dozens of new languages and frameworks that were previously impossible to use for web development.

Re:Single Page Applications using Rust by nurettin on Tuesday August 11, 2020 @12:25PM (#24122155)
> have always been opposed to the framing that people creating new web development tools is a bad thing.

You mean you support the creation of a new JS UI framework every other week? Or is this about something else?

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @12:29PM (#24122195)
Yes, I support developers doing whatever they want and releasing it to the commons for all to benefit from if they so choose. If that means "a new framework every week" then it is what it is, I don't see the problem with that. Just because someone wrote some code and put it on the internet doesn't mean you have to use it.
Re:Single Page Applications using Rust by nurettin on Tuesday August 11, 2020 @02:20PM (#24123777)
I am for the same thing, except when it specifically means a new JS UI framework every week. Nobody needs that.
Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @07:33PM (#24127169)
> Nobody needs that.

You have no idea what people need when they decide to create whatever is they want to create, if you don't want to use it you don't have to.

Re:Single Page Applications using Rust by nurettin on Wednesday August 12, 2020 @04:27PM (#24136514)
That's the problem. Since I have no idea, I have to attend a meeting at the start of the week to discuss whether I need it or not with the staff because everyone wants the next hot thing. It isn't a coding culture or freedom problem as you put it, but rather a corporate space problem and much more often than not, it just causes unproductivity.
Re:Single Page Applications using Rust by dgb23 on Tuesday August 11, 2020 @12:40PM (#24122348)
I agree with with the intent of your statement!

However:

> Nobody wants to hand-write wasm (...)

As a side note I want to point out that it is actually quite feasible to hand-write WASM in the text representation WAT.

It has some high level control constructs, type checking, some unique safety guarantees and a simple memory model.

Writing some (simple) programs in WAT and possibly a small language compiler for WASM is quite educational, fun and can be inspiring.

It can also build a more grounded intuition for the performance characteristics of WASM.

Re:Single Page Applications using Rust by root_axis on Tuesday August 11, 2020 @12:57PM (#24122576)
For sure! I find WASM to be quite readable, its actually an impressive feat of bytecode design.
Re:Single Page Applications using Rust by onion2k on Tuesday August 11, 2020 @01:09PM (#24122736)
None of that eas necessary for WebAssembly to be developed.

Theres no churn in WebAssembly tooling and frameworks yet, because WebAssembly has yet to make a big impact on many front end devs. We will see the jQuery-but-WebAssembly for making binding easier, Bootstrap-but-WebAssembly for making UIs and React-but-WebAssembly for managing components (not actually those libraries, but equivalents) come along and they will get adopted to make applications that serve large bundles of WebAssembly code that could be done better in simpler tools. That is inevitable.

WebAssembly will be used badly. Everything is, especially in web dev. Hopefully it will also be used well though.

Re:Single Page Applications using Rust by cheez on Tuesday August 11, 2020 @02:23PM (#24123838)
The tools are not sophisticated, they are brute forced.

I'm not sure I've seen a more elegant approach to frontend web development in 2020 than Vanilla JS.

Maybe with some lit-html on top.

Re:Single Page Applications using Rust by bdcravens on Tuesday August 11, 2020 @12:54PM (#24122533)
I feel like there's a movement to try to reel that in while keeping many of the advantages, via server-side DOM diffing over websockets (LiveView, Blazor, Stimulus Reflex, etc)
Re:Single Page Applications using Rust by pjmlp on Tuesday August 11, 2020 @03:02PM (#24124443)
This was already possible with browser plugins.

Active State had ActiveX plugins for using Perl and Python instead of JavaScript.

Re:Single Page Applications using Rust by tyingq on Tuesday August 11, 2020 @11:50AM (#24121686)
I suspect it won't really hit until the changes that enable direct DOM access, and things that make dynamic languages easier to implement in WASM. These things: https://github.com/WebAssembly/proposals/issues/16
Re:Single Page Applications using Rust by throwaway234101 on Tuesday August 11, 2020 @04:56PM (#24125876)
Is that still happening? It looks like it's been on the back burner for a few years now.
Re:Single Page Applications using Rust by devwastaken on Tuesday August 11, 2020 @10:58AM (#24120952)
It took 15 years for llvm and wasm to be made. Sandboxing and cross compilation in a way that isn't crazy has always been a big problem for allowing the web to just run whatever it wants. Though I'm still skeptical on wasms real security given its use in browsers is independently implimented, non seperable from the Js stack, and we're still using JIT. Everyone else goes and impliments their own runtime too.
Re:Single Page Applications using Rust by ChrisSD on Tuesday August 11, 2020 @11:09AM (#24121094)
Independent implementations are important. We don't want another Flash.
Re:Single Page Applications using Rust by pjmlp on Tuesday August 11, 2020 @03:04PM (#24124469)
"Everything Old is New Again: Binary Security of WebAssembly"

http://www.software-lab.org/publications/usenixSec2020-WebAs...

Re:Single Page Applications using Rust by amelius on Tuesday August 11, 2020 @11:14AM (#24121157)
We could as well have used VirtualBox instead to sandbox applications on the web, and run them at near-native speed. No need for LLVM and WASM. The only thing needed would be to incorporate VirtualBox into the browser.
Re:Single Page Applications using Rust by derefr on Tuesday August 11, 2020 @11:23AM (#24121261)
Besides VirtualBox being an single implementation rather than a standard, that wouldn't have worked—VirtualBox is just a hypervisor, not an emulator, and so "has" whatever ISA the host has. So you'd need separate binaries for x86, ARM, etc.

Google did a much better version of this, without these problems; they called it PNaCl. People still didn't like it, because LLVM IR is still not technically a formal standard, only a de-facto one.

Re:Single Page Applications using Rust by wtetzner on Tuesday August 11, 2020 @11:30AM (#24121381)
> because LLVM IR is still not technically a formal standard, only a de-facto one.

I'm not sure if this is still the case, but last time I looked into it LLVM IR also changed between releases in ways that were not backward compatible.

Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @11:36AM (#24121474)
It is both not platform-independent, and not stable. That's not to say that this means it's bad! It was just not designed for that kind of purpose whatsoever.
Re:Single Page Applications using Rust by amelius on Tuesday August 11, 2020 @11:30AM (#24121371)
> So you'd need separate binaries for x86, ARM, etc.

I don't see this as a fundamental limitation.

Perhaps I should have said QEMU instead of VirtualBox.

Re:Single Page Applications using Rust by derefr on Tuesday August 11, 2020 @11:45AM (#24121584)
Google first developed NaCl, and that was rejected because of this problem. The main driver, I think, was that you can't predict the computing landscape. Just because we have certain common architectures around right now, doesn't mean there won't be new architectures around 20 years from now, and/or doesn't mean the architectures around now won't be dead by then.

The thing about the web, and web standards, is that web clients (browsers) are expected to be able to work with web apps, on a common "web platform." Users expect to be able to take an up-to-date web browser and point it at any arbitrary old website, and have it work. And web platform engineers agree that this is how things should be, and make sure that browsers do everything they need to do to make this possible.

But having the possibility of a web app delivering one of N different binaries for each of a bevy of random ISAs—and no requirement to support all ISAs, only whichever ones the site's author felt like deploying—means that the browser authors of 20-years-from-now, to support users' expectations of arbitrary old web apps "just working", would need to ship N virtual-machine interpreters, one for each ISA that people ever compiled web binaries for.

Basically, it'd be a not-quite-combinatorial explosion in VM/runtime implementation work, which would decrease the quality that any one VM/runtime could have (which is really bad when those very implementations are one of the main sources of security vulnerabilities for attacking computers today.)

And, even then, there'd still always be sites broken because they shipped native code only for a platform nobody ever bothered to build support into browsers for; or used an instruction only available on some extension of an ISA that only appears in some particular proprietary chipset.

The web-standards people all agreed that, if you were going to have "object code for the web", it was much better to constrain the web to one "abstract machine" ISA. All the browser authors could then put all their effort behind implementing just one high-quality runtime/VM serving that abstract machine.

The only dispute, after that, was what form the ISA would take. Google suggested LLVM IR, and was shot down. WASM came up with their own proposal, and it got accepted, probably mostly because it was a proposal for a standalone formal standard, rather than a de-facto part of something else.

Probably, any ISA that was standalone in a similar way could have been used instead of WASM. But that is a surprisingly rare quality in an ISA. (For example, neither JVM nor CLR bytecode is a standard independent of the platform/runtime it's a part of. You can't become a member of the "JVM ISA steering committee", only a member of the Java working group.)

Re:Single Page Applications using Rust by k__ on Tuesday August 11, 2020 @11:28AM (#24121348)
"took us 15 years of being flamed every time you pointed out you didn't like Javascript"

Rust is a special case here, light weight, and loved by JS devs.

I'd still "flame" anyone who wants to drop a C# or Java VM on their users.

Re:Single Page Applications using Rust by pansa2 on Tuesday August 11, 2020 @11:49AM (#24121660)
> Rust is [...] loved by JS devs.

Is it? That's interesting, because to me the two languages seem to be polar opposites.

Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @11:56AM (#24121766)
When you're looking for a new technology to invest in, something that's very different from your current focus can be quite valuable, as it gives you a lot to learn, a lot of new things you couldn't do before, etc.

"loved by JS devs" is maybe a bit strong, as there are a LOT of JS devs, but we do enjoy a lot of JavaScript folks getting involved with and/or using Rust, and I and others have given a bunch of talks about Rust (with and without wasm) at JavaScript conferences that were well received.

Re:Single Page Applications using Rust by jimmaswell on Tuesday August 11, 2020 @01:12PM (#24122789)
What killer features does Rust have that I'm missing out on writing web apps in plain old Javascript? The only impressions I got trying to learn Rust are that it's very inconvenient, esoteric-looking (syntax is garbled about randomly from the norm for no apparent reason other than to be different - why go to such pains shortening everything like pub and fn when fn x -> int takes up so much more space than int x?), and really just not something I'd want to go through just to write a webpage.

Static checking etc. is nice but what's wrong with things like typescript? Do we really want web libraries fragmented into a million languages?

Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @01:43PM (#24123266)
Just because they're JS devs, doesn't mean that they're doing web development with Rust, to be clear. That's part of the whole "expanding what you can do" bit.

> randomly from the norm for no apparent reason other than to be different

This has been written about in a number of places, and I don't have time to get into it, but a lot of languages are trending in this direction with syntax because it is more regular in a language that contains pervasive type inference. It's not random.

> Static checking etc. is nice but what's wrong with things like typescript?

Typescript still has node (or deno, still V8) as a runtime, so you're still dealing with its runtime, and all the cons (and pros) there. Additionally, the guarantees you get out of TS and Rust are different, as they have pretty different type systems, even if they're both statically typed, and TS is closer to Rust than it is to JS.

Re:Single Page Applications using Rust by woah on Tuesday August 11, 2020 @05:16PM (#24126075)
A dislike of the function keyword used in a language seems like an incredibly strange and arbitrary way to make a decision about it
Re:Single Page Applications using Rust by dgb23 on Tuesday August 11, 2020 @01:14PM (#24122807)
The Rust ecosystem shares some characteristics and idioms that are familiar and appealing to JS developers, like:

- leaning on (some) pragmatic FP concepts

- modern tooling and dependency management

- very _approachable_ and solid documentation, books etc. (see MDN, Rust by Example, Rust Book, Eloquent Javascript...)

- both can target the browser (well)

- Mozilla has a very good name in the Web dev community. I think at least; this is definitely relevant to me.

Re:Single Page Applications using Rust by runawaybottle on Tuesday August 11, 2020 @11:54AM (#24121734)
You know what’s even more interesting? Using a low level language for no obvious performance reasons in the browser (as in, what performance critical thing are you solving?).

I just remember having to do a lot of my college classes in C++, where some of our basic programs needed variables to be constantly cast into another type just to do something with it. I remember, man, I cannot wait to have to deal with this when I parse json data from an api request, bring it on.

I am JS developer, and apparently I love Rust.

Re:Single Page Applications using Rust by dmit on Tuesday August 11, 2020 @12:26PM (#24122157)
I start missing Rust approximately 30 minutes into every new Typescript project I work on because there's no good alternative to Rust enums (and other benefits that come with them, like pattern matching). I can't derive basic traits for my data, like specifying equality or a canonical ordering. I can't define math operations for my calendar types, my units of measure, or my 3D graphics structs. (De)serialization of data is a minefield.

In what world is Rust a lower level language compared to JavaScript at this point?

Re:Single Page Applications using Rust by runawaybottle on Tuesday August 11, 2020 @08:28PM (#24127475)
To preface, I don’t know Rust. Just looking at that code, that stuff has references to memory. In what world is a reference pointer not lower level?

That seems like a much bigger minefield, but I’d be happy to be educated on this. I’d ask that part of that education include why I’d ever introduce this class of problems into web development.

Re:Single Page Applications using Rust by dmit on Tuesday August 11, 2020 @09:19PM (#24127713)
I think that's the question most people starting to learn Rust ask. The answer is a bit hairy because of how much modern garbage-collected languages normalized data sharing. Whether you're writing Ruby or Java or C# or Python, you can always do `a = BigStruct(); a.name = 'tiny struct'`.

Rust is the first mainstream language that looks at this code and says "Hold on, are you the only one modifying `a.name`?" And the intimidating part is not the question. The question is not for you. The intimidating part is that the Rust compiler asks itself the question, and it always knows the correct answer.

What the Rust compiler is looking at is the same thing the senior programmers are looking at during code reviews at your company. The people who know who should own which data. In C, once you `malloc` a struct someone has to know to `free` it. That's the rule. You acquire a resource? You're in charge of releasing it. Or at least passing the responsibility of freeing it over to someone else.

Rustc is the ultimate code reviewer. Yes, it's super pedantic, but also, hey, it can take any amount of insults you can throw at it and still thrive. If you run out of things to call it and the code still doesn't compile, guess what, the problem is probably on your side.

I repeat, Rustc is the perfect code reviewer you could ask for. And it's available 24/7. Compilation speeds are not very fast? Ok. Compare them to code review times from your peers when using a lesser language. 10 seconds for an incremental compile doesn't seem so bad when the alternative is to get instant feedback and a comment 16 hours later that you missed an edge case.

Sorry for the big post. Thanks if you read the whole thing; kudos if you scrolled straight down. Be kind, work hard, and good things will happen.

Re:Single Page Applications using Rust by _underfl0w_ on Tuesday August 11, 2020 @03:53PM (#24125177)
> In what world is Rust a lower level language compared to JavaScript at this point?

The embedded one. Can't write bootloaders or kernels in JS. I mean, maybe you could but... why would you?

(On mobile here, bear with me if no newlines came through)

Re:Single Page Applications using Rust by dmit on Tuesday August 11, 2020 @08:24PM (#24127456)
I see your point, but I think it only exposes the weakness of the terms "high-level" and "low-level" when used to describe programming languages. Rust is both low-level in that it can be used to write code for very small computers, but also high-level thanks to all the useful abstractions it provides.

There is no axis on which JavaScript (with or without Typescript) is a higher-level language than Rust in 2020. Rust offers a richer standard library, much MUCH more powerful facilities for modeling data, state-of-the-art (de)serialization that's one crate import and a one-liner annotation away.

I don't know who came up with asm.js, but that person definitely knew. JavaScript's destiny is to be a building block. Yes, it feels nice to write plain JS without importing any libraries. It's nice knowing the difference between `Array#slice` and `Array#splice` without looking it up on MDN. But it felt just as nice for ASM coders in the 80s to bypass a C compiler, and look where we are now.

Re:Single Page Applications using Rust by neilparikh on Wednesday August 12, 2020 @12:49AM (#24128685)
You should try PureScript, ReasonML or Bucklescript.

You’ll get all that (and more), and it’ll be higher level.

Additionally, these languages are designed to target the web, so they have a lot of libraries and bindings for JS libraries already written.

Re:Single Page Applications using Rust by dmit on Wednesday August 12, 2020 @01:36AM (#24128879)
I have. Purescript doesn't have typeclass derivation. BS technically does, but the time I tried it the compiler plugin was so raw it was basically useless to me. BS/Reason don't support operator overloading. Etc etc.

Redex's library selection is anemic compared to Crates.io, and so is Pursuit's. There are a couple of gems in both, but for any given use case it's just as likely you will have to write your own code than find a workable solution in the package manager.

More importantly, Rust has orders of magnitude higher bus factor than Purescript and ReasonML combined. Phil Freeman has long since left his project, and so will eventually Hongbo Zhang, at which point Reason will follow PS's slow downward spiral into open source limbo.

Believe it or not, I actually put a bit of thought into this. And I do firmly believe that Rust is by far the best ML-like language for the web available to the public right now. Perhaps I should finally write that blog post I keep putting off.

Re:Single Page Applications using Rust by StreamBright on Tuesday August 11, 2020 @04:34PM (#24125651)
>> no good alternative to Rust enums

So you are missing a basic feature that a bazillion other languages can give you. I am still amazed how people think that the ML features in Rust somehow new inventions.

Re:Single Page Applications using Rust by dthul on Tuesday August 11, 2020 @05:08PM (#24125991)
There are no good alternatives in Typescript. Nobody claimed that there are no other languages with enums.
Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @12:00PM (#24121829)
Just because that was your C++ college experience, does not mean that reflects the experience of C++ today, let alone Rust today.
Re:Single Page Applications using Rust by runawaybottle on Tuesday August 11, 2020 @08:07PM (#24127354)
Look, that web app in that tutorial is roughly 200-300 lines of code in regular js/css/html, maybe less.

The onus is on you guys to tell me why I’d add cognitive overhead for simple webapps, and if it’s coming from the Rust community, I’m expecting to hear ‘performance’, in which case I’m game.

I have the same opinion on overheard in the JS churn cycle, it’s up to you to make the case why the overhead makes sense for the cruddiest of apps.

We shouldn’t coronate things willy nilly. If Rust is the one true blood prince of the C era, I expect him to reign in similar domains, but please don’t flex that power in domains where you are a sub standard solution.

All hail Rust, but jesus, slow down. That’s a simple js app.

Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @08:50PM (#24127583)
I don't know what to tell you. It's a blog post. Simple apps are how you start to learn things. Nobody is saying that doing this is the most amazing end all be-all JS is dead and over lololol.

Some people like Rust. Some people like web apps. Some people want to use Rust to write web apps. If you don't, there are tons of other technologies you can (and should!) use to do that, and someone saying "hey if you're interested, here's how with a small example" isn't a threat to any of that.

Re:Single Page Applications using Rust by runawaybottle on Tuesday August 11, 2020 @09:20PM (#24127715)
Fair enough. The thing about the developer community is that many of the best and worst trends came from innocuous blog posts. From innocuous conference talks. It’s a blessing and a curse.

I no longer treat these posts as banal.

Re:Single Page Applications using Rust by GordonS on Tuesday August 11, 2020 @01:27PM (#24122993)
Personal opinion: Rust seems as bizarre choice as C/C++ would be for web apps, regardless whether it's for the frontend or backend - I'd personally much prefer to use a higher-level language like C#, F#, Go, Scala or Kotlin.
Re:Single Page Applications using Rust by StreamBright on Tuesday August 11, 2020 @04:35PM (#24125664)
F# turned out to be a great option for us, we combine it with Elm and they work very well together.
Re:Single Page Applications using Rust by Nelkins on Wednesday August 12, 2020 @09:26AM (#24131832)
If you feel comfortable, consider making a PR to this repo of companies using F#: https://github.com/Kavignon/fsharp-companies . Always good to have another success story!
Re:Single Page Applications using Rust by pjmlp on Wednesday August 12, 2020 @05:04AM (#24129908)
Actually that is how we were writing web apps in 2000, with Apache and IIS plugins written in C and C++ plus some scripting language like Tcl, but I wouldn't do it today, besides providing Web UI for IoT devices.
Re:Single Page Applications using Rust by GordonS on Wednesday August 12, 2020 @05:14AM (#24129960)
I was there :) I have memories of writing CGI apps, and it's not something I'd relish a return to.
Re:Single Page Applications using Rust by k__ on Tuesday August 11, 2020 @01:51PM (#24123392)
Well, Rust is higher level than C, but not nearly as heavy as the others you mentioned.
Re:Single Page Applications using Rust by kroltan on Tuesday August 11, 2020 @01:59PM (#24123510)
The qualms you describe are with static typing, not necessarily low-level languages.

And considering TypeScript is so favored as a way to "herd the cats" of JavaScript typing, it seems not everybody shares your opinion.

People go to Rust not necessarily because it's "fast" or "low-level", but possibly because it has a expressive type system that lets you be precise and correct without having to be verbose.

Sure, the fact that it can be used at the low-level and for performance-intensive applications can be a very good thing, but it is far from Rust's only merit.

Re:Single Page Applications using Rust by pcan77 on Tuesday August 11, 2020 @03:06PM (#24124509)
I promise you that the amount of JS devs who LIKE Rust is not very high. I cannot imagine going from a language like JS or TS to the confusing syntactical monster that is Rust.

I realize this is an unpopular opinion, but JS/TS is WAY more human readable than Rust is. It's almost the equivalent of programming in C for the browser. Plus, literally anything you could ever want to use in already in the JS ecosystem and doesn't have to be reinvented in Rust.

Re:Single Page Applications using Rust by bilkow on Tuesday August 11, 2020 @04:05PM (#24125346)
I do not disagree on the amount of JS devs who like rust (how many even know that rust exists?), what you think is a syntactical monster I find more readable than JS (except when generics are abused, which is rare in my experience). Just by having no parenthesis around "if" it becomes a lot cleaner, and together with anonymous / arrow function syntax in js it becomes even more confusing. Its still very subjective, but if you're going just for clean syntax, I feel like python is the real winner.

Also, explicitly borrowing in method signatures is a BIG plus for me as its a lot easier to understand an API when its clear whether it mutates or not an argument, as opposed to JS where number arguments just cannot be mutated and pointer arguments (such as arrays) always can be mutated. I find understanding random github projects a lot easier in rust than js or python.

I'm not saying you should use rust, but many like rust specifically because of its readability and even find they're more productive in the long term because of its "high level" features and explicitness (although LEARNING it is a lot harder).

Re:Single Page Applications using Rust by skratlo on Tuesday August 11, 2020 @05:05PM (#24125960)
> literally anything you could ever want to use

...so but how's the quality of npm ecoshitstem? last time I heard you guys had some trouble in paradise, plus everything noteworthy is owned by either facebook or google, both having huge antitrust issues lately

Re:Single Page Applications using Rust by balfirevic on Tuesday August 11, 2020 @02:31PM (#24123957)
I still hope that we'll get a lightweight (or lightweight enough, at least) .NET VM on WebAssembly. Blazor is far from lightweight currently, but it's runtime wasn't purposefully written for the task and is based on Mono.

Rust certainly has an advantage here, as it was design to not require a runtime system.

Re:Single Page Applications using Rust by pjmlp on Wednesday August 12, 2020 @05:06AM (#24129915)
That is more an issue with the current implementation than anything else, there are other managed languages with much better AOT compilation support for WebAssembly.
Re:Single Page Applications using Rust by balfirevic on Wednesday August 12, 2020 @11:04AM (#24132735)
I'm mostly concerned by download size. That might remain relatively large even if AOT compiled, because GC and runtime still need to be shipped with the application.
Re:Single Page Applications using Rust by pjmlp on Wednesday August 12, 2020 @12:18PM (#24133578)
That is why linkers are relevant.

Tiny Go, D and AssemblyScript all manage small enough download sizes.

Then just like with native apps, one doesn't necessarily need to download everything at once.

Re:Single Page Applications using Rust by StreamBright on Tuesday August 11, 2020 @04:32PM (#24125633)
>> Rust is a special case here, light weight, and loved by JS devs.

Is there any data on that?

Re:Single Page Applications using Rust by untog on Tuesday August 11, 2020 @11:13AM (#24121140)
> It only took us 15 years of being flamed every time you pointed out you didn't like Javascript

I don't think that has ever been an unreasonable reaction. Nor is it all that unique: if you want to do iOS development in something other than Objective C or Swift then the iOS dev community is going to tell you that you're making a mistake. And they're often right.

I've used Rust. I like Rust a lot. But one thing I don't see mentioned in this article at all: "debugger". Or "inspector". The web development stack has some incredible tools to aid in development, debug code, memory usage, etc. etc. Can you still use them with this single page app? If not, what strength is Rust bringing here that you can't achieve with the standard web dev stack?

Re:Single Page Applications using Rust by vlovich123 on Tuesday August 11, 2020 @11:27AM (#24121321)
1. You can integrate existing high-quality libraries more natively

2. You can write your backend and front end in the same language which can be appealing to increase the ability for more people in the org to contribute code (eg you don’t need to hire a traditional web developer).

3. Tooling in rust is different. I’m sure the state of debugging and inspecting WASM will get better (I don’t actually know the state) but you’re now not limited to the tooling just in the browser and you can run all of that offline in a server

4. Performance

5. Tooling isn't there yet but it's an area of active development. Debugging in Chrome: https://developers.google.com/web/updates/2019/12/webassembl...

Re:Single Page Applications using Rust by untog on Tuesday August 11, 2020 @11:42AM (#24121550)
> you’re now not limited to the tooling just in the browser and you can run all of that offline in a server

When it comes to DOM interaction (a key part of this article) you absolutely can’t.

I see the logic in compiling a native library to Rust and using it via WASM. It’s the part where you bring the whole DOM WASM-side that I’m sceptical about. As you say, tooling isn’t there yet. Is performance even there yet? Last I heard WASM<->DOM interaction incurs a performance penalty. Right now it all feels like a “because I can” capability. I’m not saying that will always be the case, but for right here and now I’m sceptical.

Re:Single Page Applications using Rust by swsieber on Tuesday August 11, 2020 @12:25PM (#24122150)
You can write your stuff in such a way to minimize the WASM<->DOM interactions. And there is a speed benefit for pure WASM stuff, so I can see it being a net win if you're using a good framework that pushes you in the right direction.
Re:Single Page Applications using Rust by milesvp on Tuesday August 11, 2020 @01:38PM (#24123172)
Not sure about this particular instance, but I can tell you about a project I’m working on in C++ that compiles down to wasm.

I was working on some prototype code that would eventually run on an embedded device, so C++ was the obvious choice for that work. Getting it all running in a linux app using SDL was a good starting point, but then I needed to collaborate with some very non technical people. At that point using Emscripten to compile the code to run in the browser ended up being useful work. I can upload the resulting html, js, wasm file to a webserver and anyone with a link can take a look.

Most of the debugging I do outside of the browser. But I was able to do some debugging using the web inspector.

But you’re right. I’m not sure that the tooling is quite there yet for a more generic single page app. My code tends to destroy the browser if left open, and it’s hard to tell why (most likely something memory related that doesn’t translate well).

I’m tempted to do more experimenting with cross compiling to wasm, but I’m not sure if my goal was production code on a browser I’d target anything but HTML5 CSS and JS+framework.

That said, there’s something to be said to being able produce a webapp while having no direct need for HTML & CSS. In the article author was still using HTML and CSS, so mostly the Rust was to avoid JS. My use case allowed me to not have to know HTML to produce a page. There’s also lots of precedent with game devs using Unity or Haxe tool chains to cross compile to the browser.

Re:Single Page Applications using Rust by ar_lan on Tuesday August 11, 2020 @11:58AM (#24121793)
I think the same could be said about node, though. A big ideal would be to be able to use the same libraries, code, tooling, etc. instead of needing to fragment with multiple languages/impls/skills/tools/etc.

I don't know why anybody would choose Javascript for a server except for the fact that it's also Javascript, so you can largely share your stack between front-end and back-end. But I'm not convinced Javascript is all that great of a choice compared to most other languages out there for backend development, albeit it being very popular.

Re:Single Page Applications using Rust by doomedlung on Tuesday August 11, 2020 @01:05PM (#24122694)
oh yeah, why's that then?
Re:Single Page Applications using Rust by ar_lan on Wednesday August 12, 2020 @01:29PM (#24134464)
It's single-threaded, it's much slower compared to languages like Go, Java, etc, and for any app that performance needs to be a consideration, Node would just never be my first choice.

If I'm building a blog, then maybe it makes sense, but for high profile web apps/infra I just don't understand the appeal beyond using similar tooling and having the learning curve be the same (e.g. at least on the surface your UI and backend engineers can theoretically be the same).

I guess it generally depends on what you are building, but I tend to prefer something a bit beefier. I also love Go, so I may have a bias there, though the performance bits are data-driven, not subjective.

Re:Single Page Applications using Rust by arkanciscan on Tuesday August 11, 2020 @11:39AM (#24121520)
When you figure out that you still have to use the DOM and CSS you're gonna turn right back around like grandpa Simpson.
Re:Single Page Applications using Rust by runawaybottle on Tuesday August 11, 2020 @11:44AM (#24121579)
That and ui/ux programming. Gotta make sure you are displaying the right stuff, and be meticulous about your UI events/interactions.

JavaScript might suck, but it’s got all the normal basic shit other languages have. Loops and shit, variables and stuff. You guys aren’t complaining about a little old language, you’re complaining about UI development and how tedious it can actually be if you want a professional level of polish.

Re:Single Page Applications using Rust by gameswithgo on Tuesday August 11, 2020 @12:04PM (#24121885)
don't have to, can use webgl.
Re:Single Page Applications using Rust by untog on Tuesday August 11, 2020 @01:07PM (#24122716)
Bye bye, accessibility!
Re:Single Page Applications using Rust by dom96 on Tuesday August 11, 2020 @11:35AM (#24121460)
Are we? There are and have been plenty of languages that target JavaScript for many years now. What does webasm actually enable that wasn't possible before?
Re:Single Page Applications using Rust by flohofwoe on Tuesday August 11, 2020 @12:50PM (#24122471)
Performance (asm.js was pretty close but required special support from the JS engine too).

But maybe more importantly: WASM frees Javascript from the future burden of being both a human-friendly programming language, and a machine-friendly compilation target.

Re:Single Page Applications using Rust by fulafel on Wednesday August 19, 2020 @02:02PM (#24213695)
Performance for a few low-level languages yes (Rust, C/C++), but with the GC support stalled and even less developed language interop story, there isn't anything in the horizon that promises to make it a good platform for today's HLL's. Meanwhile there are many nice HLL's targeting JSVM with good performance.

I think the human friendliness transition happened already when most JS programmers started compiling their JS-version-du-jour to legacy-JS.

Re:Single Page Applications using Rust by pjmlp on Tuesday August 11, 2020 @03:05PM (#24124484)
Plugins already made that performance possible.
Re:Single Page Applications using Rust by gameswithgo on Tuesday August 11, 2020 @12:03PM (#24121867)
As per usual in the world of languages, nothing new is possible, but things can be easier and perform better.
Re:Single Page Applications using Rust by camgunz on Tuesday August 11, 2020 @12:29PM (#24122197)
This is what WebAssembly has to say about it: https://webassembly.org/docs/faq/
Re:Single Page Applications using Rust by gedy on Tuesday August 11, 2020 @12:38PM (#24122317)
It's funny because non web folks complain about Javascript fatigue and no standard libraries/approaches - so now on top of that we are going to mix in other languages and everyone bikeshedding the same thing in N languages? Seems maintaining apps with all this code is going to get a lot harder.
Re:Single Page Applications using Rust by pas on Tuesday August 11, 2020 @12:57PM (#24122581)
There is/was Scala.js too, and other similar things that "transpile" to JS.
Re:Single Page Applications using Rust by sushshshsh on Tuesday August 11, 2020 @11:52AM (#24121714)
It's the year 2020 and I'm still out here writing JSP, PL/SQL, and VB6 lmfao
Re:Single Page Applications using Rust by jermaustin1 on Tuesday August 11, 2020 @12:00PM (#24121825)
I've actually been wanting to do a video series on using VB6 to build a modern web application. It would have a Windows Form GUI obviously.
Re:Single Page Applications using Rust by arethuza on Tuesday August 11, 2020 @12:10PM (#24121963)
A company I used to work for did an acquisition where the company being acquired had written their own web server in VB6. I never did find out why...
Re:Single Page Applications using Rust by sushshshsh on Tuesday August 11, 2020 @12:31PM (#24122231)
Wtf how is more important than why actually LOL. The why probably involves consultants and a lot of powerpoint
Re:Single Page Applications using Rust by AndrewUnmuted on Tuesday August 11, 2020 @01:02PM (#24122661)
I found this [0] suspicious-looking source code from 2002 that may be able to give some answers.

[0] https://www.developerfusion.com/code/2184/dm-web-server/

Re:Single Page Applications using Rust by stjohnswarts on Tuesday August 11, 2020 @07:51PM (#24127280)
You should play with a language like Go or Python and get that rush of modernity
Re:Single Page Applications using Rust by sushshshsh on Wednesday August 12, 2020 @10:45AM (#24132514)
Idk why but I just really like javascript. I am not the type of person that likes to optimize things or make a deeply viable and robust and performant output. I just like to tinker and have as many things as possible abstracted away from me so I can make stupid apps based on maps and if statements so that they can do stupid things in a matter of 20 mins.
Re:Single Page Applications using Rust by jaywalk on Tuesday August 11, 2020 @11:58AM (#24121797)
Please tell me this is a joke.
Re:Single Page Applications using Rust by laurentdc on Tuesday August 11, 2020 @12:33PM (#24122255)
I know of at least two insurance companies in my country that still have their administrative software written in VB6 (probably along with some shoddy web app for IE8).

Also see "IT runs on Java 8" https://veekaybee.github.io/2019/05/10/java8/

Re:Single Page Applications using Rust by est31 on Tuesday August 11, 2020 @12:03PM (#24121877)
There are two phases of a technology: the adoption for new projects phase, and the legacy phase. In the first phase, new projects dominate the programming activity in the technology. In the second phase, maintenance and improvement of already existing codebases dominates the activity. Technologies like jsp are in that second phase.
Re:Single Page Applications using Rust by sushshshsh on Tuesday August 11, 2020 @12:30PM (#24122214)
Wish it was! My life is full of Dim iX As Integer and CURSOR AS right now and it's pretty gross. But it's better than writing css or react at least.
Re:Single Page Applications using Rust by cdelsolar on Tuesday August 11, 2020 @12:50PM (#24122472)
um no it's not
Re:Single Page Applications using Rust by AndrewUnmuted on Tuesday August 11, 2020 @01:04PM (#24122678)
Can't we agree that they're both just awful?
Re:Single Page Applications using Rust by alsdkfjkqjwer on Tuesday August 11, 2020 @11:02AM (#24121009)
...and to reset the score, yet again, on usability/accessibility. sigh.
Re:Single Page Applications using Rust by Thaxll on Tuesday August 11, 2020 @01:03PM (#24122670)
"where you can choose whatever language you want to program for the web" if by chosing meaning doing PoC during the week-end maybe ... for real work we don't have a choice.
Re:Single Page Applications using Rust by monadic2 on Tuesday August 11, 2020 @11:31AM (#24121394)
I mean, don't do this for other reasons, like it's an accessibility nightmare.
Re:Single Page Applications using Rust by riquito on Tuesday August 11, 2020 @11:47AM (#24121623)
You are getting downvoted because the rendered page is HTML, which has the same accessibility properties as always
Re:Single Page Applications using Rust by monadic2 on Thursday August 13, 2020 @10:24PM (#24152494)
There's more to rendering than looking at the DOM at static points in time. There's certainly more to accessibility that conveying changes to the dom which may or may not be "visible", or certainly relevant, to the end user.
Re:Single Page Applications using Rust by samcgraw on Tuesday August 11, 2020 @11:51AM (#24121703)
Other than 10% of the globe unable to run wasm, what accessibility concerns come to mind here? Are there any that wouldn't also apply to a SPA that uses JS to manage the DOM?
Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @12:02PM (#24121855)
Some people believe that wasm will encourage people to turn web pages into one big <canvas>, which would be quite a hit. I don't personally believe that, though.
Re:Single Page Applications using Rust by Shared404 on Tuesday August 11, 2020 @01:12PM (#24122795)
I had in fact considered playing with and possibly deploying something like this if I liked it.

I'd like to thank this thread for reminding me why that's probably not a good idea.

Are there any good resources to read up on for making sure accessibility is good in <canvas>? I assume you'd have to implement it yourself.

Re:Single Page Applications using Rust by rikroots on Tuesday August 11, 2020 @04:00PM (#24125276)
> Are there any good resources to read up on for making sure accessibility is good in <canvas>

whatwg.org[1] is less than helpful when it comes to to describing how to make sure canvas elements are accessible; MDN[2] is a little more helpful. tl;dr: it's a lot of hard work.

I have found some relatively useful posts in various places (eg: [3]) for people (like me) who don't like being told not to do something. These articles generally date from around the mid 2010s but, given that there has been little development in the <canvas> world since then, their advice is still good today.

[1] whatwg - https://html.spec.whatwg.org/multipage/canvas.html

[2] MDN - https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/...

[3] - https://developer.paciellogroup.com/blog/2015/02/html5-canva... - including this link because post was updated in 2020

Re:Single Page Applications using Rust by Shared404 on Tuesday August 11, 2020 @05:46PM (#24126404)
Thanks, I've favorited this.
Re:Single Page Applications using Rust by steveklabnik on Tuesday August 11, 2020 @01:43PM (#24123273)
I have no idea personally, I imagine you'd have to implement it all yourself, yes, and I don't even know if the proper hooks are there, honestly.
Re:Single Page Applications using Rust by monadic2 on Thursday August 13, 2020 @10:26PM (#24152516)
The typical concerns that come with dynamic DOM manipulation....
Re:Single Page Applications using Rust by loxs on Tuesday August 11, 2020 @11:43AM (#24121557)
Funny thing is, this is not strictly needed anymore, as TypeScript is probably the best language in existence right now.

edit: OK, maybe not compared to Rust... but here it wins by ease of learning.