"Be explicit" - embarrassment

I hesitate; it’s not easy to share embarrassment… but it’s too iconic to pass up. (No actual help is needed, by the way, but this is the only category that made sense.)

My way over-simplified line of code:

foo(blah); // we don't care about the result this time

The comment is my real comment, a holdover habit where I’ve occasionally wanted to clarify, but the language doesn’t offer a clarification construct. You see where I’m going now. Of course, I got the following error: “return value from foo() ignored”! Well duh! That’s what I said, isn’t it?! Of course, it’s so much easier to write:

_ = foo(blah);

AND it has the side-benefit of actually compiling. :slight_smile: The only problem is that it deprives me of the opportunity to write a needless long //comment… and inspires me to write a needless long post instead. But maybe I’m not the only one who brainfarts while transitioning from other languages. The rest of you just wasted your time and you’re trying not to laugh just a little.

11 Likes

You can still write the comment. In fact you should, as punishment.

2 Likes

The hardest thing about learning a new language is letting go of where you’ve come from. In your case, you can see the advantage immediately, but you’ll see a lot of discussions that are:

  • Person A: I think Zig should include X
  • Person B: Zig does it differently. We do Y instead.

Person A either then holds-fast and refuses to adapt, or they embrace the new different way. I’ve found (after a few times on either side of this discussion) that it’s best to listen and try to adapt the first time. Then when you’ve lived with the new way a while you have a much better perspective to criticise.

1 Like