Vasco Costa
vascocosta.bsky.social
Vasco Costa
@vascocosta.bsky.social
🦀 Developer | 🔧 Engineer | 🏁 Petrolhead | 🌍 Explorer

I like technology, computers, programming, solving problems, math, science, motorsport, traveling... Jack of all trades, master of almost none.
ES2024 brings some kind of pattern matching to switch, but I think it's more about object destructuring, so probably still not usable in the same fashion as say in Rust.
May 22, 2025 at 7:03 AM
Once you go cargo there's no turning back... It's one of the reasons why Rust becomes ever more popular. On top of all the language goodies, tooling is really important.

I've been myself thinking about getting back to some C/C++ projects but not getting enough motivation when I think about tooling.
April 27, 2025 at 8:41 AM
A shoutout to @rockorager.dev for this, zeit, libvaxis and more. I often read his code as a means to improve my #ziglang skills.
April 26, 2025 at 4:40 PM
I think people still consider C/C++ as a new language due to the sheer number of software written in them. Lots of job opportunities. Companies that are adopting Rust/Zig still need someone with C/C++ knowledge to convert old codebases. But from a purely enjoyment point of view, probably not many.
April 19, 2025 at 9:38 PM
I had a VPS with not enough RAM (for Python, Go and C#). I started coding in Rust and Zig and now I have a VPS with too much RAM I don't use. 👍
April 16, 2025 at 7:31 PM
Day 682 of typing `zig build -Doptimise=ReleaseSafe` instead of `zig build -Doptimize=ReleaseSafe`. #ziglang
April 16, 2025 at 3:24 PM
Thank you so much for sharing. 😍
April 12, 2025 at 3:43 PM
Good observation.
April 11, 2025 at 8:42 AM
In a way bork0 and bork2 looked a bit "funny" in my Rust example, because I was directly translating your go example as verbatim as possible, which included trying to mutate the data inside the function.
April 10, 2025 at 6:28 PM
Even though we need mut in both bork0 and bork2's function parameters (because we are mutating the local variables), the real beauty of Rust like you mentioned is that when calling the functions, since we don't pass a &mut as argument, we clearly see there won't be any mutation of the parent data.
April 10, 2025 at 3:24 PM
When I was learning Rust chatgpt had just been released. It did a good job, but also produced quite broken code (more than nowadays).

However the explanations it provided about the hard concepts to grasp in Rust were spot on and definitely taught me a lot!

I think LLMs are great as teachers.
April 10, 2025 at 1:15 PM
This.

For some time I didn't know this or would forget and need a refresher. Go is minimal and easy to keep in your head for life, but details like this weren't for me.

I would forget sometimes, finding out the hard way at runtime. Rust improved me as a go coder by being so picky at comptime.
April 10, 2025 at 7:41 AM
As a golang coder I used to get confused by this. As you mentioned, there's no explicit indication of mutability/immutability.

Then I learnt Rust and it really made me think. The mut keyword is clear. Better than the implicit way in go where a reference implies mutability and a value immutability.
April 9, 2025 at 9:10 PM
allocPrint is equivalent to template literals/strings in Javascript.

const name = "John";
const age = 30;

Javascript:
const message = `My name is ${name} and I am ${age} years old.`;

Zig:
const message = std.fmt.allocPrint(alloc, "My name is {} and I am {} years old.", .{ name, age });
April 8, 2025 at 6:59 PM
Concatenating strings requires more memory as the resulting string will be bigger.

Zig is explicit when this happens. It does not allow, hidden allocations. So if we were to use something like a + operator, it would hide the allocation.

My favourite functions:

std.fmt.allocPrint
std.mem.concat
April 8, 2025 at 8:02 AM
Maybe you'll also find arena allocators interesting. You allocate a region of memory once at the beginning of the program and then do a single deallocation at the end.

There's no need to match individual allocs with frees each time, lowering the chances of creating a leak by forgetting to free.
April 8, 2025 at 7:46 AM