Live data from Hacker News

Why I chose Lua for this blog

andregarzia.com

141–150 of 159 posts

Re: Why I chose Lua for this blog

#141
Always glad to read histories of Lua in the wild, it certainly is kind of an odd language but its simplicity and embedability makes it for a great choice for a lot of use cases.

I used to like moonscript coffescript-like syntax, but nowadays I mostly like plain lua, though Fennel looks appealing.

Re: Why I chose Lua for this blog

#142
post #77

I worked with Lua for awhile but never got over the 1-based indexing.

You'd get used to it eventually. Many of us had to go the other way. I grew up with BASIC and Wirth languages (Pascal, Modula-2, etc) that were 1-indexed and to this day even after 25, 30 years of working professionally in 0-based indexed languages I still catch myself here and there having to adjust (and whiteboard coding can sometimes throw me off under pressure), but clearly operate just fine. I worked briefly pro…

As Fortran is, not was.

Re: Why I chose Lua for this blog

#143

Earlier quoted context omitted.

Yet I've witnessed Lua 5.1 launching faster than luajit for some of my use cases. My point still stands though. Don't just use LuaJIT thinking it will magically make things faster in all cases. If you are embedding, LuaJIT is a no-brainer. If you are using a stand-alone interpreter, measure if you care about reality.

> If you are embedding, LuaJIT is a no-brainer. If you are using a stand-alone interpreter, measure if you care about reality. This seems backwards. Lua is easier to embed and luajit is just as easy to install standalone and has zero downsides.

> zero downsides

I just said that I have measured it being slower in at least some use cases.

JIT gains better when already compiled paths run repeatedly. Most long running programs embedding Lua will choose luajit for this reason.

I don't care what people use, the point is that JIT compilation isn't magic that makes everything faster. The way to know is measure.

Re: Why I chose Lua for this blog

#144
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?

Every headline when I was in college was "App J Sold for a Gizzillion Dollars." So, I figured I would learn programming and join the club. Easier said than done. Nevertheless, I started watching YouTube videos titled "Make a Clone of J."

In hindsight, it was a horrible way to learn. Most YouTubers probably benefited more from clickbait teaching than from actual fundamental teaching. Eventually, I was able to navigate the internet and land on an actual structured curriculum, whose lectures and courses were long and boring but taught you the fundamentals of programming.

I am picking up a similar pattern with Vibe Coding. Beginners are more excited about having a launched product wrapped with a band-aid rather than having deep knowledge.

Re: Why I chose Lua for this blog

#145
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 keep thinking a nice client app that is mostly working against a directory of markdown files that "publishes" to an option of fastly/denoland/cloudflare as mostly-static content would be a pretty nice option.

The blog/data directory can be backed up or even using a github repository for long term raw storage.

I'm not a fan of having the same site/application for rendering as editing the blog as it tends to become too much of a big/easy target... ie: Wordpress, how much internet traffic is script bots trying WP exploits?

Re: Why I chose Lua for this blog

#146

LuaJIT is awesome. I've been converting my Bash scripts/functions to it, with much success thus far.

You may want to benchmark lua versus luajit if you are writing scripts or other short-lived programs. JIT-compiled languages aren't generally faster in starting up, they generally are used to speed up long-lived programs that have hot sections.

I'll tell you what, it's a hell of a lot faster starting up than Bash is, but I hear you.

You know what the new interesting hotness might be? Getting the LLM to write wasm (via wat, its textual analog), and running that with https://wazero.io/ , which is astonishingly fast (although still not as fast as luajit for some reason, despite being lower-level), but also gaining multiplatform without recompile in the process

Re: Why I chose Lua for this blog

#147
post #100
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.

When I was a teenager I wrote my first "CMS" and was very proud. A few months later someone called my parents and asked for me. He said he was a developer and found some issues with security. He gave me a few tipps and suggested me some books and left for good. Never talked to hm again but this was so kind and I learned a lot about secure coding after that.

I wrote a "CMS" in college as a project in PHP (really hot then) so you could drag txt files and images into whatever directories and it would create web pages based on that. Professors were not impressed: "why you would want such thing, a MS Access would be better". I was disappointed, but hey, that's life.

Re: Why I chose Lua for this blog

#148

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…

[deleted]

Re: Why I chose Lua for this blog

#149

I am not sure why one would have to use an engine for this. A blog consist of mostly repetitive list of posts made from a single identical template. Any 10y old kid could just master it enough to write them in html directly. And pandoc is just installed in seconds from any package manager if one wants to use an even easier different markup language. Heck in age of microblogging and social medias most blogs aren't eve…

The reason it has an engine is because it also has an interface for me to post and admin stuff. The previous version was generated by scripts (using Racket and not Pandoc) and that made it harder for me to post from devices that were not my own main computer where the source lived. For example, I like posting from my phone. PS: I'm the author.

Termux and gitnex have been my friends for posting from my smartphone.

Re: Why I chose Lua for this blog

#150

Earlier quoted context omitted.

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…

Absolutely! Thank you for taking time and replying.
Post reply on HN