Live data from Hacker News

Why I chose Lua for this blog

andregarzia.com

111–120 of 159 posts

Re: Why I chose Lua for this blog

#111
post #2

Author of the blog here in case anyone has questions.

I don't have a background in web development and have a genuine question. > Your blog is your place to experiment and program how you want it I 100% agree with your statement and people don't need to justify their hobbies. I've done really pointless things simply for lolz and because I wanted. My question arises because I was surprised in how ... architected and (dare I say) complex the tech stack in your blog is. In…

Thanks for the questions, let me see if I can address them:

The stack doesn't feel as complex to me because I know it well. Familiarity doesn't make it less complex but make it comfortable. The reason for the database is that it allows me to run queries. It makes it easier for creating "recent posts" and "posts with this tag" pages.

Lua is the glue that ties it all together. Yes, HTML/CSS can be used to create a full site but writing posts in HTML gets tiresome fast when typing on a phone for example. The way it is it has an admin interface that allows me to write markdown on my phone or edit a post. It is handy.

For my own personal projects it is less about technical reasons and more about what will make me happy. What brings the joy on and less about what is the optimal solution.

Does that makes sense?

Re: Why I chose Lua for this blog

#112
post #2

Author of the blog here in case anyone has questions.

What are your thoughts on something like arturo which I know is quite recent but it has a lot of features for scripting and an argument might in fact be made that it is in fact it might have too many batteries but it was an absolute pleasure to learn and I had a lot of aha moments in their discord server and the community was really pleasant to follow through actually. I know its definitely smaller but I just want yo…

Never heard of Arturo before. Went to their page after reading your comments. Omg, it looks so cute and good. Defo up my alley. I love functional and minimalist languages. Thanks for sharing that.

I might play with it for some project in the future.

Re: Why I chose Lua for this blog

#113
post #8
post #2

Author of the blog here in case anyone has questions.

I currently run a blog generator I wrote in fennel and have been considering switching to pollen haha. Slightly surprised you didn’t pick fennel over lua since you used racket before. Is there a reason you didn’t?

I absolutely love Pollen. Do it! I switched away from Racket because I wanted less moving parts. With Lua (a language I know better than Racket) I feel I have a better grasp of all the parts. The main reason to switch away was to make the codebase smaller and easier to tinker with, but the pollen version was great.

Fennel is absolutelly amazing, I love it. I just didn't had the need. I like Lua the way it is. I was a student at PUC Rio for a while, I fell in love with it there and am very familiar with it.

Re: Why I chose Lua for this blog

#114

I spend a lot of time blogging but all I use is a ~50 line Python file that converts my markdown pages to HTML, adds my template, and generates the ToC page. Then I push to GitHub Pages. I can't imagine needing more than that. Why are these blog stacks so complex?

I had a similar setup in the past. The current stack can be explained by:

1. I don't want to rely on any external SaaS but my VPS. No github action to rebuild the site or anything like that.

2. I want to be able to post from multiple devices, which means that SSGs add more friction cause I'd need to make sure the source is up to date on all machines I am trying to post. It is not a hard problem, but opening an editor online and posting is much easier. The key to blogging is reducing friction.

Re: Why I chose Lua for this blog

#115
post #38

I spend a lot of time blogging but all I use is a ~50 line Python file that converts my markdown pages to HTML, adds my template, and generates the ToC page. Then I push to GitHub Pages. I can't imagine needing more than that. Why are these blog stacks so complex?

I had that thought too. My own blogging engine is ~100 lines of lua that accomplishes the same as you describe, plus RSS, with one additional library for markdown parsing. The author mentions Mustache templates and WebMentions, but ten dependencies still seems like a lot; I wonder what they are.

The dependencies are

    cmark
    dkjson
    etlua
    hasher
    lsqlite3
    lua-markdown-extra
    luafilesystem
    lub
    lustache
    multipart
    penlight
    uuid
    yaml
    http
    gumbo
    sleep
    bbcode
    cookie
Many of the dependencies are there to support the posts that are legacy posts coming from my previous SSG. I imported them into the database and they require Yaml and other dynamic features. Some dependencies like gumbo, http, multipart are all there to support indieweb features such as webmentions and micropub.

Re: Why I chose Lua for this blog

#116
post #7

I don't know man, every time I tried to learn Lua (to write nvim plugins and HammerSpoon spoons) I disliked the ergonomics of the language. I don't understand why people say it's an easy language— easy ≠ simple

It all depends on what you been exposed to in the past, right? I find Lua simple because it is a minimalist language in which there are very few things to learn. You can buy "Programming in Lua" for the version you want to use and with a single book you learn about basically all of the language and its internals. That is not the same with some other languages.

Re: Why I chose Lua for this blog

#117
post #5

I miss the days when "implement your own blogging engine" was one of the most popular learning projects for engineers. We should bring that back! Its such a great way to play around with client- and server-side development options in an almost zero-risk environment.

I suppose it's because fewer people have personal web sites these days?

What is the typical learning project these days for beginners of a programming language?

Re: Why I chose Lua for this blog

#118
post #7

I don't know man, every time I tried to learn Lua (to write nvim plugins and HammerSpoon spoons) I disliked the ergonomics of the language. I don't understand why people say it's an easy language— easy ≠ simple

it's easy, but the 1 indexes and global by default suck

I wrote about this in:

https://andregarzia.com/2021/01/lua-a-misunderstood-language...

I like 1 based indexes and the globals don't hurt me on my projects. It is like JS, it has its own bits that are different than other languages, once you learn them you see that it is mostly fine.

Re: Why I chose Lua for this blog

#119

As a a javascript dev I kinda feel you and agree that the tools are moving faster than most codebases. The thing is though, you don't really have to use that many tools unless you really want to. You can spin up a node server yourself and use web components and it will run fine probably just as long as the lua code will. It's also way easier today to just use web components and not any framework since LLMs can help y…

I am extremelly biased against LLMs so take my opinion with a grain of salt. I opted to run a CGI script instead of spinning my own webserver cause webservers are tricky. I'd rather run something like nginx or caddy. I like nodejs (my preferred JS engine will always be Mozilla's and for the terminal I been favouring Bun) but part of using Lua on my own blog is cause of JS fatigue. I'm exhausted with the JS workflow these days.

Re: Why I chose Lua for this blog

#120
post #30

I liked this post, and I can totally understand where you’re coming from… But couldn’t anything you say about Lua also be said about JS? You mentioned how Lua wasn’t batteries included, so you try to limit your libraries. Couldn’t you say the same for JS? JS itself doesn’t change much, it’s the ecosystem. Couldn’t you just pick out some small and stable libraries the same way you could with Lua?

I love JS, don't get me wrong, I absolutelly love Javascript. But I love the JS that the browser runs and understands. I hate the current ecosystem of bundlers, transpilers, typescript, npm modules and so on.

Yes, I could have picked a js runtime and done the same thing. The same thing could also have been done with literally any other language.

It is less of a "Only Lua Can Do This" situation and more of a "I Like Working with Lua" situation.

Post reply on HN