comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Rephrase static-and-const

Open sakex opened this issue 2 years ago • 2 comments

Fixes https://github.com/google/comprehensive-rust/issues/66

sakex avatar Apr 27 '23 20:04 sakex

Hey Alex, thanks for taking up that old issue! We should find a nice way to outline how to handle global state since it comes up immediately when people start migrating to Rust.

About mutable statics: @Manishearth told me recently that it's effectively impossible to use a mutable static correctly. I don't know the details, but you end up triggering UB in almost all cases (if I understood correctly).

mgeisler avatar Apr 27 '23 21:04 mgeisler

Ok, good to know 😅 I didn't know if I had to edit those things or not. I will revert.On Apr 27, 2023 23:33, Martin Geisler @.***> wrote: @mgeisler commented on this pull request.

In po/pt-BR.po:

msgstr "O estado global é gerenciado com variáveis estáticas e constantes."

#: src/basic-syntax/static-and-const.md:5 msgid "## const" msgstr "## const"

#: src/basic-syntax/static-and-const.md:7 -msgid "You can declare compile-time constants:" +msgid "Constants are values created at compile time. They are inherently more efficient because they don't need to be computed at runtime and the compiler can inline them and apply special optimizations that would not be possible with a larger set of values:"

Ah, this illustrates the problem well: by changing the msgid field here, you're claiming that

Constants are values created at compile time. They are inherently more efficient because they [...]

should be translated into Portuguese as

Você pode declarar constantes de tempo de compilação:

I don't speak Portuguese, but that's clearly wrong 😄

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

sakex avatar Apr 27 '23 21:04 sakex

Hi @sakex, let's get this merged or closed. I saw that we now also have #1019, which updates the same slide.

Can you trim down your edits so the slide stays very concrete and then we can merge this?

mgeisler avatar Jul 26 '23 08:07 mgeisler

Oh yes, I completely forgot about this. Fixing before lunch

sakex avatar Jul 26 '23 08:07 sakex

Oh yes, I completely forgot about this.

Me too :smile: I was just going over the old PRs to see which we could merge.

mgeisler avatar Jul 26 '23 08:07 mgeisler

Thanks for the update @sakex!

@qwandor and @domenukk, I think you two know much more about static and const than me... can I get you to review this PR?

mgeisler avatar Jul 26 '23 09:07 mgeisler