Live data from Hacker News

Writing a website in Rust

blog.viraptor.info

21–30 of 141 posts

Re: Writing a website in Rust

#21

Earlier quoted context omitted.

If you're going to write a block of text like that, you could at least fact check the main premise. Rust had GC. They started off with GC, so it wasn't the very first decision that "no code can perform with garbage collection". Here's a post about removing GC from core rust 2 years ago: http://pcwalton.github.io/blog/2013/06/02/removing-garbage-c... Next: they didn't kill GC. They removed it from core, because rust i…

Rc and Arc aren't exactly GC types... they are just reference-counted pointers, Rc being akin to C++'s shared_ptr. I get that in a sense, this is garbage collection, but certainly not full-featured like the ones you find in other languages.

You can use full GC in Rust--we use the SpiderMonkey GC to collect Rust DOM objects, for example. It's not the most easy-to-use thing, however.

Most systems software gets by fine with a combination of thread-safe and thread-local RC. Reference counting is a form of garbage collection that works really well when it's used only for the subset of data that needs GC--which is the style that Rust encourages anyhow.

Re: Writing a website in Rust

#22
The tooling for the web written in JavaScript is excellent, so I was curious, are there any options there are for calling JavaScript from Rust code? I know there is the ffi module for NodeJS that allows you to call Rust from JavaScript, but I was wondering if there is something that works well in the other direction.

Re: Writing a website in Rust

#24

Earlier quoted context omitted.

If you're going to write a block of text like that, you could at least fact check the main premise. Rust had GC. They started off with GC, so it wasn't the very first decision that "no code can perform with garbage collection". Here's a post about removing GC from core rust 2 years ago: http://pcwalton.github.io/blog/2013/06/02/removing-garbage-c... Next: they didn't kill GC. They removed it from core, because rust i…

Rc and Arc aren't exactly GC types... they are just reference-counted pointers, Rc being akin to C++'s shared_ptr. I get that in a sense, this is garbage collection, but certainly not full-featured like the ones you find in other languages.

I have disagree. I know what you mean in practice - the GC is not the default and some types will always be different. But reference counting and types with destructors is a valid implementation of GC.

Gc is "just" an automatic memory management. Rust is not a garbage collected language, but it does have optional garbage collection available.

Re: Writing a website in Rust

#25

Well, IMHO, "the right hammer for the right nail". Rust is a great systems language (besides the lack of bitfields) but I wouldn't use it as a web language. Just as much as I wouldn't use C++ to develop webapps. Sure you can do it but then again there are far easier ways to achieve your goal.

Out of curiosity (I've never done systems programming), what are some of the things that make a language more suited to systems programming rather than web (other than libraries and community support - I'm more interested in the intrinsic qualities of the language)?

Re: Writing a website in Rust

#26

Well, IMHO, "the right hammer for the right nail". Rust is a great systems language (besides the lack of bitfields) but I wouldn't use it as a web language. Just as much as I wouldn't use C++ to develop webapps. Sure you can do it but then again there are far easier ways to achieve your goal.

Out of curiosity (I've never done systems programming), what are some of the things that make a language more suited to systems programming rather than web (other than libraries and community support - I'm more interested in the intrinsic qualities of the language)?

Standard library, look at PHP it's all about web!

Re: Writing a website in Rust

#27
post #23

Hey OP, have you tried the other "future" languages like go or Elixir? If so, how does it compare with your experiences in rust?

No, sorry. I did some erlang (directly, not elixir), but not for websites. I really missed strict types and compiler validation there. I know there's dializer and others, but it's just not the same level of comfort.

I've done one website in C however and can tell you that Rust is way more predictable ;-)

Re: Writing a website in Rust

#28

Well, IMHO, "the right hammer for the right nail". Rust is a great systems language (besides the lack of bitfields) but I wouldn't use it as a web language. Just as much as I wouldn't use C++ to develop webapps. Sure you can do it but then again there are far easier ways to achieve your goal.

Out of curiosity (I've never done systems programming), what are some of the things that make a language more suited to systems programming rather than web (other than libraries and community support - I'm more interested in the intrinsic qualities of the language)?

Super fast, type safe (and thread safe in Rust), compiled, low/no cost abstractions

Re: Writing a website in Rust

#29
post #28

Earlier quoted context omitted.

Out of curiosity (I've never done systems programming), what are some of the things that make a language more suited to systems programming rather than web (other than libraries and community support - I'm more interested in the intrinsic qualities of the language)?

Super fast, type safe (and thread safe in Rust), compiled, low/no cost abstractions

Super fast? More like Java ballpark: http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

Re: Writing a website in Rust

#30

Well, IMHO, "the right hammer for the right nail". Rust is a great systems language (besides the lack of bitfields) but I wouldn't use it as a web language. Just as much as I wouldn't use C++ to develop webapps. Sure you can do it but then again there are far easier ways to achieve your goal.

Out of curiosity (I've never done systems programming), what are some of the things that make a language more suited to systems programming rather than web (other than libraries and community support - I'm more interested in the intrinsic qualities of the language)?

For Prometheus's console templates (basically offering a html templating engine to end users to create monitoring consoles with), I used Go's own templating language as nothing else seemed mature at the time.

Go is strongly typed, and so is it's templating language. This means that you need to take a much more rigorous approach to using them, as a single unhandled edge case value can break the entire page. Contrast this with something like Jinja2 where if you mess up it'll only break a small bit of the page.

I managed to produce a usable template system, but it's still a tad more verbose than I'd like. It'd have been nice if a more scripting-language style templating language had been an option.

Post reply on HN