What is "constant reassignment warning" behavior in Ruby, and how does this relate to "freeze" on classes/modules?
Correct! Well done.
Incorrect.
The correct answer is B) Reassigning an already-initialized constant emits a warning (not an error) by default; freezing a class prevents adding new members, but the constant binding itself can still be reassigned unless its namespace is also frozen
Correct Answer
Reassigning an already-initialized constant emits a warning (not an error) by default; freezing a class prevents adding new members, but the constant binding itself can still be reassigned unless its namespace is also frozen
Ruby only warns (rather than errors) when a constant is reassigned, reflecting that "constant" is a naming convention rather than a hard guarantee; freeze affects the mutability of the referenced object/class, which is a related but distinct concept from the constant binding itself.