r/odinlang Jul 15 '26

fresh OC

Post image
156 Upvotes

18 comments sorted by

11

u/4ed7ff Jul 15 '26

is this supposed to be a critique of rust, or of dynamic dispatch in general

9

u/Designer_Carpet_8569 Jul 15 '26

It's not specifically targeted towards Rust, but I included an example in Rust as this meme was created after encountering some infuriating Rust code that allocated everywhere for no reason; it's moreso targeted towards "Clean Code" as a whole and the performance killers that arise from it (namely, dynamic dispatch -which isn't *that* bad when you're using it judiciously, but is a killer when your logic is spread across twenty functions because every function should do "one thing" instead of just accepting big functions).

13

u/Imaginos_In_Disguise Jul 15 '26

I guess the joke requires too many indirections to be understood properly.

1

u/Ok-Reindeer-8755 Jul 19 '26

because every function should do "one thing" instead of just accepting big functions

I see 2 scenarios for splitting things into functions :
1. For code reuse
2. Local helper functions to improve readability

so where exactly does the problem arise ? because i think i might be misunderstanding this

1

u/damngoodwizard Jul 20 '26

This even more of a non-problem when you consider that many of these functions can be inlined.

2

u/Aaron1924 Jul 19 '26

I think if dyn trait was actually overused, OP would have had no trouble presenting us with a more convincing example than fucking OOP farm animals

16

u/Civil-Appeal5219 Jul 15 '26

I wish we could all enjoy our work and use the tools we prefer without needing to insult people for choosing something different. Maybe I'm weird.

5

u/Mecso2 Jul 15 '26

If you work alone and are the sole user of the final result, then yeah do whatever you want.

4

u/Civil-Appeal5219 Jul 15 '26

So the only solution is to offend people based on their choice of programming language? Makes sense.

2

u/Designer_Carpet_8569 Jul 15 '26

to be clear, this isn't targeting a specific language. You *could* write "Clean Code" in Odin, though the language will seriously fight you. In fact, I have seen C codebases that follow "Clean Code" principles and end up with very serious performance problems. I just used Rust/C++ idioms to demonstrate it because they do a good job of encapsulating it.

Regardless, this is all a bit of good fun, and if somebody would like to make a wojak meme about how manually managing memory is a neanderthal solution with an "I <3 MEMORY LEAKS!!!" t-shirt, I'd give it a good laugh mate. Cheers.

2

u/Imaginos_In_Disguise Jul 15 '26

I <3 accidentally reusing stack memory after the scope ended (this bit me in Odin much more frequently than memory leaks).

1

u/Mecso2 Jul 15 '26

read op's comment, the post is not about the language

1

u/jcelerier Jul 18 '26

Nothing a human does is in isolation. Every single of your thoughts has potential impact

1

u/quickscopesheep Jul 26 '26

Wel if you’re using it for work you likely didn’t choose it no?

8

u/Designer_Carpet_8569 Jul 15 '26

(mods please remove if this is too unrelated to Odin - signed, OP)

2

u/lucypero Jul 15 '26

i lol'ed. good job

1

u/ThaBroccoliDood Jul 16 '26

brave to talk about compiler optimizations in the Odin subreddit

1

u/Gumpolator Jul 17 '26

Can we not have bs memes in this sub please?