Vasco Costa's Avatar

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.

48 Followers  |  67 Following  |  144 Posts  |  Joined: 23.01.2025  |  1.9545

Latest posts by vascocosta.bsky.social on Bluesky

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.

22.05.2025 07:03 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

As a rustacean I must say I'm enjoying using TypeScript's neverthrow. In a way, the way it allows Result composition is even neater than Rust's.

No more try/catch/throw spaghetti code again. Makes TypeScript a bit more palatable for Rust lovers.

#rustlang #typescript

21.05.2025 19:07 โ€” ๐Ÿ‘ 7    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

That good feeling when you nail a good #rustlang one-liner that may not be the most readable but is so damn neat...

27.04.2025 18:26 โ€” ๐Ÿ‘ 4    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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.

27.04.2025 08:41 โ€” ๐Ÿ‘ 4    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

A shoutout to @rockorager.dev for this, zeit, libvaxis and more. I often read his code as a means to improve my #ziglang skills.

26.04.2025 16:40 โ€” ๐Ÿ‘ 4    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Me standing next to Senna's Lotus 97T/2.

Me standing next to Senna's Lotus 97T/2.

Today on the 40th anniversary of Ayrton #Senna's maiden #F1 win during the 1985 F1 Portuguese GP at the soaked wet #Estoril Circuit, I had the chance to see his Lotus 97T/2 (the original chassis he raced). Happy fan standing next to the mythical #12 machine I remember watching on TV as a kid.

21.04.2025 18:00 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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.

19.04.2025 21:38 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
GitHub - vascocosta/zircon: A simple IRC library written in Zig. A simple IRC library written in Zig. Contribute to vascocosta/zircon development by creating an account on GitHub.

Released v0.6.0 of zircon, a simple IRC library written in Zig.

Add support for TOPIC, RPL_TOPIC and RPL_NOTOPIC
Add support for ERR_CHANOPRIVSNEEDED
Add support for ERR_ERRONEUSNICKNAME
Add support for ERR_NOSUCHCHANNEL
Add support for ERR_NOSUCHNICK

#ziglang

github.com/vascocosta/z...

16.04.2025 20:14 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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. ๐Ÿ‘

16.04.2025 19:31 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Day 682 of typing `zig build -Doptimise=ReleaseSafe` instead of `zig build -Doptimize=ReleaseSafe`. #ziglang โšก

16.04.2025 15:24 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
The Rust Language & Ecosystem - The Rust eBookshelf

For those learning or refreshing their knowledge about #rustlang who enjoy reading on their e-reader, here's a list of freely available books in ePub format, including "The Rust Programming Language":

dieterplex.github.io/rust-ebooksh...

16.04.2025 08:50 โ€” ๐Ÿ‘ 9    ๐Ÿ” 4    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Thank you so much for sharing. ๐Ÿ˜

12.04.2025 15:43 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Good observation.

11.04.2025 08:42 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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.

10.04.2025 18:28 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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.

10.04.2025 15:24 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 2    ๐Ÿ“Œ 0

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.

10.04.2025 13:15 โ€” ๐Ÿ‘ 0    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Post image

This is a good-hearted piggyback on a previous post by @rkuris.bsky.social.

OK #golang experts who don't know #rustlang! Without running this code and with one eye closed, how many of these modify their parent's data value?

Playground: play.rust-lang.org?version=stab...

10.04.2025 08:51 โ€” ๐Ÿ‘ 5    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

10.04.2025 07:41 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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.

09.04.2025 21:10 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

Rust makes me a better Zig coder when it comes to naive memory errors.

Zig makes me a better Rust coder when it comes to hidden allocation awareness.

I love both, for different reasons and projects.

#ruslang #ziglang

08.04.2025 20:07 โ€” ๐Ÿ‘ 6    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
Git turns 20: A Q&A with Linus Torvalds To celebrate two decades of Git, we sat down with Linus Torvaldsโ€”the creator of Git and Linuxโ€”to discuss how it forever changed software development.

Git turns 20: A Q&A with Linus Torvalds

#git #github #linustorvalds

github.blog/open-source...

08.04.2025 19:47 โ€” ๐Ÿ‘ 2    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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 });

08.04.2025 18:59 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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

08.04.2025 08:02 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

08.04.2025 07:46 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

fn main() {
println!("Welcome!");
}

06.04.2025 06:51 โ€” ๐Ÿ‘ 9    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Well, as an oldschool IRC user I like the IRC channel at Libera, but I think the Ziggit forum is a better starting point for a newcomer who needs help about some Zig topic. If you're on Discord, that would be my third-choice. Anyway the community feels welcoming no matter which medium.

06.04.2025 05:14 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Anyway, it still hurts me that Hamilton lost it all at the last moment the way it happened.

I believe we share that feeling.

05.04.2025 22:20 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I don't think that in that case in particular he was reckless. More like a weird situation. That said, I think Max was reckless hundreds of times since he joined F1.

The reason they didn't have a serious crash in 2021 was probably because Hamilton took evasive action against his moves.

05.04.2025 22:18 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Do you think Max realised his wheels were on top of Lewis Hamilton's head and that the halo didn't quite work in that freak accident and then he tried to use the throttle to harm him instead of getting back on track?

By the way, when he pressed the throttle the wheels had already cleared his head.

05.04.2025 21:31 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

@vascocosta is following 19 prominent accounts