Is "pointless discard" too harsh?

Maybe I’m too thin-skinned, but pointless could be perceived as harsh or offensive? Following the lead of error descriptions like “use after free”, maybe this error could be described more gently (and even more illustrating) as “discard before use”, “use after discard”, or “contradictory discard”?

let’s take a look at synonyms

  • ‘absurd’ is really harsh and even offensive/insulting
  • ’ unnecessary’ is quite neutral and harmless
  • ‘stupid’ is definitely not good
  • ‘meaningless’ is possibly more “polite”, than “pointless”.

    :slight_smile:
1 Like

stupid would be hilarious. :smiley: Reminds me of the insults option in sudoers that insults you when you type an incorrect password at sudo.

1 Like

I would love an --offensive option… I can picture the errors: stupid discard of variable, you worthless git!. :slight_smile:

1 Like
const std = @import("std");
pub fn main() void {
    const x: u8 = 0xAA;
    _ = x;
    std.debug.print("x = {}\n", .{x});
}
$ /opt/zig-0.10/zig build-exe pd.zig 
pd.zig:6:9: error: pointless discard of local constant
    _ = x;
        ^
pd.zig:7:35: note: used here
    std.debug.print("x = {}\n", .{x});
                                  ^

at least it is clear what is wrong due to the note.

Having different levels (3…5 or so) of politeness/rudeness would be even more wonderful!
:grinning:

2 Likes

just do 'sudo su -' once.

Instead of

error: expected tuple or struct argument, found comptime_int

when you don’t pass a tuple to print, you’d get

how many times do I have to tell you that it has to be a freakin' tuple or struct? Sheezzz...
2 Likes

Is “pointless discard” too harsh?

It is psychologically interesting topic.
I think insults from a computer program are not that much insulting compared to similar insults from real people (I mean people you are socializing directly), even if expressed with the same words.

2 Likes

I do not see that message as offensive – it’s just pointing out that the discard statement has no business existing, since the value is actually in use – but I suppose it could be reworded as “redundant discard”, which maintains the spirit of the error message and it sounds more neutral :slight_smile: