News for hackers. Stuff that matters.
Re:A pure JavaScript implementation of Git for Node and brow... by zeth___ on Wednesday May 16, 2018 @08:09PM (#17087495)
Javascript runs everywhere where there is a browser.

Rust runs everywhere where there is a c compiler, which is funnily enough the sample places that C/C++ run.

Re:A pure JavaScript implementation of Git for Node and brow... by zaarn on Thursday May 17, 2018 @03:53AM (#17089580)
I'm not sure on the last point, a lot of architectures, especially niche ones, aren't supported by Rust at all while there are plenty of C compilers for them going around.

(have fun trying to get Rust working on 8bit controllers or Itanium/ia64)

Re:A pure JavaScript implementation of Git for Node and brow... by ryanbrunner on Thursday May 17, 2018 @09:28AM (#17091083)
I think the point is less that Rust runs everywhere that C runs, and more that there doesn't exist an environment that can run Rust and not run C (which is not true for Javascript)
Re:A pure JavaScript implementation of Git for Node and brow... by vlovich123 on Thursday May 17, 2018 @10:49AM (#17091736)
Can you clarify this point? To me it would seem with Rust being able to target WASM/ASM.js that you could indeed target all the same environments JS does.
Re:A pure JavaScript implementation of Git for Node and brow... by regularfry on Thursday May 17, 2018 @01:56PM (#17093680)
Emscripten means that's not a distinguishing feature from C or C++.
Re:A pure JavaScript implementation of Git for Node and brow... by vlovich123 on Friday May 18, 2018 @01:06AM (#17098855)
My response was to the last part that there's an environment where Javascript can run but Rust can't. I agree that C/C++ targets are a strict superset but I'll posit that for all the architectures that matter it's the same surface area at which point the calculation for which to use is about ease-of-use, correctness, etc.
Re:A pure JavaScript implementation of Git for Node and brow... by bluejekyll on Wednesday May 16, 2018 @08:51PM (#17087710)
And with wasm, Rust/C/C++ all can run in the browser too...
Re:A pure JavaScript implementation of Git for Node and brow... by fineline on Wednesday May 16, 2018 @10:44PM (#17088315)
JS in the browser has direct integration to the DOM, networking, various local data persistence APIs, and other IO and sensors (webcam, accelerometer...) etc. Rust can be compiled to run in a sandbox, which can then be integrated via a remote call interface with the JS layer, and thus be indirectly (via JS) connected to the above APIs, but there are currently concerns around the performance of this approach. Rust cannot independently manage a web page which hosts it, without JS. There is some way to go before browsers support practical, accessible and performant front-end web apps in Rust.
Re:A pure JavaScript implementation of Git for Node and brow... by zeth___ on Wednesday May 16, 2018 @09:13PM (#17087845)
Not quite yet. But getting there.
Re:A pure JavaScript implementation of Git for Node and brow... by bluejekyll on Thursday May 17, 2018 @05:14PM (#17095916)
Re:A pure JavaScript implementation of Git for Node and brow... by erikpukinskis on Thursday May 17, 2018 @03:03AM (#17089373)
When people say “The Browser” they mean “that thing which is on literally every computer where you instantly load that one kind of software”.

People think the web is a technology, or that JavaScript is a language.

They’re not. It’s not. The web is an idea: it’s the idea that every computer in the world already has the runtime on it that can run your next app. Whatever that is—whatever that runtime is—that’s “The Browser”.

WASM is not that. Maybe in 10 years.

Re:A pure JavaScript implementation of Git for Node and brow... by nulagrithom on Thursday May 17, 2018 @11:37AM (#17092238)
What are you babbling about? The web is technology. JavaScript is a language. And WASM is shipping in all major browsers already.

You don't have to wait 10 years. You can start using WASM today.

Re:A pure JavaScript implementation of Git for Node and brow... by erikpukinskis on Friday May 18, 2018 @01:30AM (#17098952)
It hurts my feelings that you think I’m babbling. I’m trying to be as articulate as I can.

I don’t want to write software just for people with 2 year old iPhones. I write software for everyone, especially people who can’t afford anything but the hardware they’re stuck with. That’s why I’m not going to target WASM.

That’s my point: to me, “The Web” isn’t just modern browsers on newish devices. It’s the whole world as an audience. I think that’s why so many people target the web.

I also think WASM is premature optimization in almost all situations.

That said, I totally support anyone who wants to target it. It’s dope technology. If you love Rust and you want to write browser apps with it, and limit your audience a little, knock yourself out. I don’t think you’re embracing what the web is for, but there’s no law that says you have to.

Re:A pure JavaScript implementation of Git for Node and brow... by somenewacc on Thursday May 17, 2018 @06:37AM (#17090164)
emscripten can compile to both wasm and asm.js and load them depending on browser support. this seems good enough.
Re:A pure JavaScript implementation of Git for Node and brow... by erikpukinskis on Friday May 18, 2018 @01:35AM (#17098965)
Performance won’t be as good as hand tuned JavaScript with native DOM calls.
Re:A pure JavaScript implementation of Git for Node and brow... by abiox on Friday May 18, 2018 @12:02PM (#17102499)
webassembly has vastly improved performance in a variety of situations.
Re:A pure JavaScript implementation of Git for Node and brow... by abiox on Thursday May 17, 2018 @12:24PM (#17092740)
afaik webassembly has shipped in all major browsers - edge, firefox, opera, chrome and safari... including mobile versions.
Re:A pure JavaScript implementation of Git for Node and brow... by erikpukinskis on Friday May 18, 2018 @01:36AM (#17098971)
If your audience can exclude the very poor and people with extreme bandwidth limitations ( for updating OS, etc), or you can afford to just tell people “no” then that’s certainly a decision you can make. But you’ll be saying no to a lot of people.
Re:A pure JavaScript implementation of Git for Node and brow... by abiox on Friday May 18, 2018 @12:00PM (#17102484)
i'm sorry but i don't quite follow what you're trying to say.
Re:A pure JavaScript implementation of Git for Node and brow... by erikpukinskis on Saturday May 19, 2018 @03:00PM (#17109208)
I’m getting a lot of pushback in this thread so I’ll put this in the “maybe I’m wrong bucket”.

I’ll wait to talk about it again until after I have experience doing browser compatiblility testing with a WASM toolchain.

Re:A pure JavaScript implementation of Git for Node and brow... by hsaliak on Thursday May 17, 2018 @01:40AM (#17089016)
You mean wherever there is llvm? It's a large subset, but it is still a subset.
Re:A pure JavaScript implementation of Git for Node and brow... by zeth___ on Thursday May 17, 2018 @02:30AM (#17089247)
Huh til that rust isn't compillable by gcc.
Re:A pure JavaScript implementation of Git for Node and brow... by palotasb on Thursday May 17, 2018 @06:57AM (#17090248)
That's different. The rust toolchain is compiled by rust, and it relies on LLVM which can be compiled by GCC. But LLVM does not have a backend for every architecture (or even if it does, it might require extra effort from the Rust compiler using it and they have not enabled support for _everything_). Thus not all architectures can be targets for Rust programs.
Re:A pure JavaScript implementation of Git for Node and brow... by noobermin on Wednesday May 16, 2018 @11:25PM (#17088467)
You're aware that most operating systems have a C API, right? Give me a place C doesn't run where js does.
Re:A pure JavaScript implementation of Git for Node and brow... by jakelazaroff on Thursday May 17, 2018 @01:22AM (#17088939)
In a browser. Yes, there's wasm, but it has a lot of limitations that don't apply to JavaScript. fineline had a good comment about it upthread: https://news.ycombinator.com/item?id=17088315
Re:A pure JavaScript implementation of Git for Node and brow... by sigstoat on Thursday May 17, 2018 @01:28PM (#17093372)
Re:A pure JavaScript implementation of Git for Node and brow... by pjmlp on Thursday May 17, 2018 @05:41AM (#17089955)
Try to use the C API on Android, ChromeOS, Windows Phone, Mbed.