The C++ scope resolution operator is beautiful

3h5Hne7t1K@lemmy.world to Programming@programming.dev – 95 points –

Both zig and go use the dot operator, but I find the '::' operator much more readable.

Vec::new();

Makes it clear that were accessing a static method belonging to the Vec struct/namespace.

Vec.new()

Makes it seem like Vec is an object with a 'new' method.

Am I alone in thinking this?

17

You are viewing a single comment

That's just convention.

:: is enforced by the compiler.

Yeah, but does that matter? I don't think, I've ever accidentally broken these conventions, where compiler assistance would have been helpful.

It don't get past review if it doesn't follow standards. I'm yet to see a deviation.

If a language is bad because devs do stupid things, they're all bad.