Updates on Zill, the text editor [Update 1]

I thought building a text editor would be the hard part. It turns out relearning how to learn might be harder

Zig is a really interesting programming language.

Last week I decided I wanted to create a text editor for learning purposes. Being honest with everyone (and especially myself), I probably should have started with a different project, but it is too late to backtrack now. I’ve come to several realisations this week.

The hardest truth of all is:

I forgot how to learn properly.

The challenge

Silly me thought that after building a small game in Lua, a language I was already somewhat familiar with, I could take on any challenge. To be fair, I was not wrong at all. However, this project will be HARD. This week I’ve been researching text editors and the programming language I chose, Zig. The reality is harsh: I am no longer used to spending a long time reading and understanding the fundamentals of a programming language. My brain is now wired in a way that wants everything to be fast, automatic, and work by default. Don’t get me wrong, I am up to the challenge and I am working hard to rewire my brain to work as it used to, but it will definitely be a rough journey for me.

Background

To give you guys a little bit of background: my journey in software engineering started back in 2019 when I started doing some freelance work for people around my area. At that time my main stack was simple: Django (Python) for the backend, and if the frontend required some extra functionality I would use Vue (Django’s template system is good enough for most cases I was working on), then Postgres as the database, and voilà, you have a full-stack application up and running. I would then deploy that application to a VPS and clients would start using it.

Back then life was easy.

After some time, when I started my first corporate job, I got assigned to a NodeJS project, and I stuck with Node in my professional career ever since. The Node ecosystem is easy, fairly powerful, and widely used in the industry. Besides my professional work, I also played around a lot with Go, a language I love and try to use for all (or most) of my side projects when it comes to backend or CLI development.

What I am trying to say is: I’ve never properly worked with a low-level programming language (or a mid-level programming language, depending on who is reading), besides my college years where I did some of my learning in C++ (everything was mainly C++ or Java). I know some people might consider Go a low-level language. I personally do not. There are multiple reasons for that, but my take is mainly because Go is garbage collected, its pointers are relatively easier than those of other languages, and it is, overall, easier.

Some Updates

Now, for some miscellaneous updates: I started learning Zig. That’s the main outcome.

My reason for choosing Zig is simple: it is a low-level language (or again, mid-level depending on who is reading), and it works really well with C, meaning I can use any C library in my project without many issues (this is important as it makes rendering a window fairly easy due to the amount of C libraries like SDL or Raylib). It gives me a lot of control and at the same time it is strict enough to help me build my project safely, without having to fight the compiler too often (I am talking to you Rust). Finally, I found Zig’s build system powerful and fascinating.

Overall, it’s been a pleasant experience so far. I like Zig. It’s a fun language to use, it is powerful yet elegant, and the learning curve is not as steep as if I was choosing something like C++ or Rust, which makes it (in my opinion) the best choice when it comes to a first low-level language. (C is also a really good option, but I wanted something other than C.)

Thanks to all those choices, I am slowly getting used to reading, writing, and debugging code again, and I am enjoying the process. I am loving writing code again, which was the main goal for this series of projects.

Project Updates

The project updates are small this week. The reason for that is I am taking my time learning and understanding the language (people who state you can master a language in a week are wrong). However, there are some things I want to point out:

  • We’ve got a name! I decided to name the text editor Zill. I remember putting a lot of thought into that, but to be honest I do not remember the reasons for it (thanks ADHD).
  • Main rendering library will be raylib: It is simple to use, it is powerful. Nothing else to add here. (Already rendered a window).
  • I read and tried to understand all the pros and cons of many text editor data structures. I’ve decided to go for a Gap Buffer. There are many ways of working with text editors, I just found gap buffers to be an elegant and simple enough solution for my case.

Next Steps

I will continue to work on Zill, however I might take on smaller projects in between (will keep you posted). The reason for that is I want to keep learning and exploring other stuff. I want to finish Zill, but I understand it will take a long time to complete to the point where I am proud of it. I want to show complete projects on this blog in the meantime. Zill will still be my main project, I will just take on other tasks as they go.

I will update again next week, and as always, thanks for reading.