What is Nostr?
Jan :rust: :ferris: /
npub12n5…ny86
2024-10-19 10:44:05

Jan :rust: :ferris: on Nostr: #Rust's module system is actually amazing! ✨ 🎡 Let's say we have a module `foo` ...

#Rust's module system is actually amazing! ✨ 🎡

Let's say we have a module `foo` that can create `Foo`s in different ways. Yes, that's it - it can only create `Foo`s.

But `Foo`s should also be able to `dance` and `twinkle`.

So we create two other modules `dance` and `twinkle` and `impl Foo` in each of them, so `Foo` can dance and twinkle.

But `Bar` can also dance - so we `impl Bar` in `dance` as well.

Do you see a pattern? You organize (primarily) by _behaviour_, not data.

#RustLang
Author Public Key
npub12n50jcn6hn6s7gnfrra0ucyqxmue8nznj2ek2dqa6eucwv2s6hyq50ny86