News for hackers. Stuff that matters.
Re:Zig, the Small Language by simlevesque on Wednesday September 07, 2022 @01:27PM (#32753500)
Eslint has `// eslint-disable-next-line no-unused-variables`, it is very useful.

I'd prefer `eslint-expect-error-next-line` instead to warm me when the comment is actually useless but it's better than what Zig seem to do.

Re:Zig, the Small Language by TakeBlaster16 on Wednesday September 07, 2022 @01:41PM (#32753663)
There's a nice eslint plugin for disable-line hygiene: https://www.npmjs.com/package/eslint-plugin-eslint-comments

I do wish Rust had something like this too

Re:Zig, the Small Language by steveklabnik on Wednesday September 07, 2022 @02:06PM (#32754002)
https://play.rust-lang.org/?version=stable&mode=debug&editio...

You can put it at the top of your file with a #! too, if you want it to apply to the whole file.

Re:Zig, the Small Language by TakeBlaster16 on Wednesday September 07, 2022 @02:17PM (#32754139)
Oops I didn't explain clearly. Take this code:

  pub fn abc() -> usize {
      #[allow(deprecated)]
      "abc".len()
  }
I want it to complain about the "allow", because there was never any deprecated warning emitted in the first place. Maybe it would be called #[expect(deprecated)]

I refactor code all the time and find these stray "allow"s that aren't doing anything anymore

Re:Zig, the Small Language by eddyb on Wednesday September 07, 2022 @03:11PM (#32755104)
> Maybe it would be called #[expect(deprecated)]

Both this and the reply saying you should open an RFC worry me that it was tongue-in-cheek.

Or maybe it's the obvious name choice, heh, because it literally exists with that very syntax: https://play.rust-lang.org/?version=nightly&mode=debug&editi...

Not stable yet, as you can see, but all the RFC and implementation work has been done, and a stabilization report was even put forward back in July: https://github.com/rust-lang/rust/issues/54503#issuecomment-...

Re:Zig, the Small Language by TakeBlaster16 on Wednesday September 07, 2022 @03:52PM (#32755802)
That's hilarious, I had no idea! I'm glad I didn't embarrass myself by proposing an RFC. Thanks for the links!
Re:Zig, the Small Language by voorwerpjes on Wednesday September 07, 2022 @02:55PM (#32754811)
This would be really cool! you should open up a RFC for it.
Re:Zig, the Small Language by steveklabnik on Wednesday September 07, 2022 @02:20PM (#32754178)
Ah, yeah that would be cool. Sorry for misunderstanding!
Re:Zig, the Small Language by simlevesque on Wednesday September 07, 2022 @02:09PM (#32754035)
Thank you !