Hacker News new | ask | show | jobs
by burnzonaut 599 days ago
I think the author is really making a mountain out of a molehill here. As they say in the article, between the compiler and widely used tools like clippy there are multiple opportunities for developers to be gently warned to disarm their footguns.

That said, the article was an entertaining read and the blog is pleasantly styled. I’m glad I spent some time with this even though my ultimate takeaway is kind of “meh”.

3 comments

Rust could just have mandated that const have to be uppercase and disallowed variables starting with uppercase. It would be better than making a warning.
If you care about this rule, you can deny it on your projects (at the crate level or for individual items), but if it were an unconditional error then it would make things like FFI or following non-Rust naming conventions either annoying or impossible.
> following non-Rust naming conventions […] impossible.

That’s indeed the point.

No it wouldn't, it's just too unergonomic of a style to force upon everyone
How is that unergonomic?

Go has proven at this point that the language spec is the correct place to settle stupid bike sheding especially when they lead to misfeature like this one.

I understand that it’s not the most urgent thing to fix when it comes to Rust syntax but still a clear downside.

You have to hold an inconvenient key while typing. And you can't assess its stupidity if you can't even understand this simple why on your own
I mean if your why is related to having to hold shift or - gasp - using caps lock, I don’t know if I can’t assess the stupidity but I certainly don’t feel I’m clever enough to hold a conversation with you.
I am working on an SDL project (not in Rust) and this example made the molehill seem slightly larger:

  // whoops, accidentally commented out or deleted this import
  // use crate::{SOME_GL_CONSTANT, OTHER_THING}

  // uh oh!
  match value {
   SOME_GL_CONSTANT => ..,
   OTHER_THING => ..,
   _ => ..,
  }
Specifically, I think FFI stuff or an initial Rust rewrite can be a strong incentive to (locally) disable compiler/linter warnings around capitalization because you are more interested in consistency with an existing C API. This turns the molehill into at least a real hill (though not a mountain).
Yeah. The article is based on known bad patterns and, e.g you should never do use MyEnum::*; and in other cases compiler gives warning. Are there people who do not want to understand the warnings and do not work in order to remove/suppress them?