Live data from Hacker News

Rewriting my blog in Rust for fun and profit

jonashietala.se

61–70 of 116 posts

Re: Rewriting my blog in Rust for fun and profit

#62
post #7

I've been trying to make a cool static site generator numerous times. Well, yes, it actually is a quite fun thing to tinker with, but I've found myself struggling to decide on what do I want to see in the final app and what I do not; what features might be needed by other users and what features might be an overkill. So I ultimately went with Zola[1] and encourage you to try it too! Aaaand it is written in Rust, too.…

I plan on writing a static site generator soon myself. And I briefly wondered the same thing and realized that I could very easily answer that question: ruthlessly build whatever I personally need and not what others need. I don't usually follow that line of thinking, but the static site generator space is so full of so many great tools that I don't think there's really anything for me to contribute to it. Instead, I…

We think alike. I started out with Hugo because it's very popular and relatively easy to use. It has a bunch of features that I had to read about but didn't have a use for -- overhead.

One of the most annoying aspects of working with hugo was the friction from idea to publishing it.

I decided to go a completely different route and built https://prose.sh

With prose all I have to do is to create a markdown file and then `scp` it to prose.sh. The platform takes care of the rest and I can still enjoy my own editor and terminal tooling. Even better, authentication happens via SSH so the friction is extremely low.

It's a nice balance between writing a blog on a platform that does everything for you and being able to use my own tooling to write content.

Another big issue with Hugo is when I want to make edits to the content. My brain is weird and I only scrutinize my content after it has been published. So I end up making a lot of edits after an article has been live for a few minutes. It's a terrible habit and Hugo required deployment for every little change.

I've thought about converting prose to be SSG -- we could generate the html when a user uploads the file -- but honestly the site is fast as it is so I don't see the value in that added complexity.

Re: Rewriting my blog in Rust for fun and profit

#63
post #7

I've been trying to make a cool static site generator numerous times. Well, yes, it actually is a quite fun thing to tinker with, but I've found myself struggling to decide on what do I want to see in the final app and what I do not; what features might be needed by other users and what features might be an overkill. So I ultimately went with Zola[1] and encourage you to try it too! Aaaand it is written in Rust, too.…

My static site generate is enough python to invoke mustache on every file in a directory. Maybe 70 lines

That's it.

Works fine.

Not everything is improved by creeping featuritis.

Re: Rewriting my blog in Rust for fun and profit

#64
post #37

Earlier quoted context omitted.

Cargo takes a rather brute-force approach to the hard problems, but it generally just fucking works , which is a comically under-rated feature! On the one hand, it’s depressing that Cargo is forced to “go it’s own way” in order to achieve some sanity because it can’t can’t trust the platforms, but working is working and I can’t remember more than one or two times I’ve seen it shit the bed. It’s pragmatic, useable, di…

> On the one hand, it’s depressing that Cargo is forced to “go it’s own way” in order to achieve some sanity because it can’t can’t trust the platforms I've used Rust and Cargo a bit but I don't have a lot of insight into it, what does Cargo actually need to implement itself instead of trusting the platform?

It may be referring to the Rust ecosystem's propensity to pull code from crates.io (and for the Rust toolchain to update itself via rustup) rather than relying on distro-level package managers.

Distros do still package Rust, and some are even relatively up to date, but finding third-party libraries that work with [insert arbitrary old version of Rust] can be a challenge, because libraries often start using new APIs quite soon after they hit stable (and obviously old versions of Rust don't know what to do with that; this is the difference between backward compatibility and forward compatibility).

Re: Rewriting my blog in Rust for fun and profit

#65
post #45

Earlier quoted context omitted.

You’re really going to call people jihadis for talking about the technical strengths of a programming language? And then you’re going to act like you’re the self appointed arbiter of discourse on HN, saying that this kind of article is ok but that kind isn’t? Maybe a person who calls those they disagree with jihadis isn’t qualified to police what others say. Let’s talk about the way you talk. Here’s you from 5 days a…

While his vocabulary might be a inflammatory, it's hard to argue that any language has an evangelistic community anywhere near the level of rust's. No other community is pushes their favorite language for every single use case. No other language has a rewrite it in rust meme. No other language attacks people for unsafe code.

You want to see criticism of Rust? Here’s the best, most accurate criticism of Rust, written by avid Rustaceans.

- Why Not Rust? (https://matklad.github.io/2020/09/20/why-not-rust.html)

- A Rust match made in hell (https://fasterthanli.me/articles/a-rust-match-made-in-hell)

Compare these with the superficial criticism that benreesman was making. He couldn’t even link to the proper issue, a fact he realised 10 hours later. Even had he linked to the right issue, he has no idea what he’s talking about. He says he had some issue with the language server and then simultaneously mentions LLVM? rust-analyser doesn’t import LLVM because it doesn’t need to generate machine code. You think when such poor feedback gets pushback it means people aren’t listening. No, it’s just poor feedback. If you want high quality criticism of Rust, read the articles I linked. Rust has many shortcomings and these folks discuss it in detail.

> no other language has a rewrite it in rust meme.

Your account is a year old. I’ve been here almost 10. I remember when everyone was excited about Go and wanted to rewrite everything in Go. And before Go it was Python. A couple of years from now they’ll be rewriting everything in Carbon.

This is normal when things are new and people are still discovering it. Most of the folks you’re encountering are excited by Rust … and that’s ok. It’s not a bad thing to be excited or share that with others. If that reduces your quality of life, I apologise. But they meant no harm.

> No other language

Firstly, no language does anything. And secondly, you’re making sweeping generalisations of a large community based on a couple of incidents. I don’t know there’s anything I can say, other than I haven’t seen it in years. No one thinks it’s a good idea to attack anyone, and moderators are usually quick to nip any anti-social behaviour in the bud.

Lastly, anyone with a lick of Rust experience knows that unsafe is useful and widely used. You can’t implement std::Vec without it, for instance.

Re: Rewriting my blog in Rust for fun and profit

#66
post #7

I've been trying to make a cool static site generator numerous times. Well, yes, it actually is a quite fun thing to tinker with, but I've found myself struggling to decide on what do I want to see in the final app and what I do not; what features might be needed by other users and what features might be an overkill. So I ultimately went with Zola[1] and encourage you to try it too! Aaaand it is written in Rust, too.…

I plan on writing a static site generator soon myself. And I briefly wondered the same thing and realized that I could very easily answer that question: ruthlessly build whatever I personally need and not what others need. I don't usually follow that line of thinking, but the static site generator space is so full of so many great tools that I don't think there's really anything for me to contribute to it. Instead, I…

I just wrote like a Perl script that generates my site. It's just printing stuff and converting markdown to HTML, right? Never breaks, never changes, does exactly what I need it to.

Presumably there are reasons people want to use more specialised tools, but I don't have any of those.

Re: Rewriting my blog in Rust for fun and profit

#67
post #62

Earlier quoted context omitted.

I plan on writing a static site generator soon myself. And I briefly wondered the same thing and realized that I could very easily answer that question: ruthlessly build whatever I personally need and not what others need. I don't usually follow that line of thinking, but the static site generator space is so full of so many great tools that I don't think there's really anything for me to contribute to it. Instead, I…

We think alike. I started out with Hugo because it's very popular and relatively easy to use. It has a bunch of features that I had to read about but didn't have a use for -- overhead. One of the most annoying aspects of working with hugo was the friction from idea to publishing it. I decided to go a completely different route and built https://prose.sh With prose all I have to do is to create a markdown file and the…

Tangentially related: the delay field in your hn profile will hide your comment for n minutes for you to make edits.

I always set mine to 2.

Re: Rewriting my blog in Rust for fun and profit

#68
I'm seeing a few too many comments about static site generators rebuilding everything on a change.

Have the tenets of Make (and the like) from over 40 years ago been forgotten?

I guess maintaining a dependency graph just isn't a high priority feature for site generators.

Re: Rewriting my blog in Rust for fun and profit

#69

I'm seeing a few too many comments about static site generators rebuilding everything on a change. Have the tenets of Make (and the like) from over 40 years ago been forgotten? I guess maintaining a dependency graph just isn't a high priority feature for site generators.

For something run relatively infrequently, I can see why it wouldn't be a huge priority.

On that topic, I wish there was a generic build system like SCons written in something faster. Maybe there is (does Bazel fit my bill?) and I just don't know of it yet. What I love best about SCons is that you can just write custom builders right there. No need to drop in a shell script - you have the much better Python standard library at your fingertips. This also means it's way easier to make cross-platform.

Re: Rewriting my blog in Rust for fun and profit

#70
Why even bother with a static generator when you can run rust code at essentially wire speed and dynamically generate all the required formatting on the fly?

Because Rust binaries are so secure, you can expose them over the internet safely. With a little bit of glue, you can automatically recompile the CGI binary every time the rs source is touched, for a dev experience similar to interpreted web scripts.

Post reply on HN