The meaning of the explosion in Ruby is “caution”. This means that you should use the method with caution, nothing more. I can’t find the link anymore, but people in the government explicitly stated that it was a destructive method. An explosion is just a semantic element associated with caution. The programmer must weigh everything and decide when to use the punch.
For example, in my simulator, I use the #step method to get the step size.
simulation.step
and step! to actually complete the simulation phase.
simulation.step!
But as for the #reset method, I decided that the word "reset" is quite a lot, and there is no need to use bang to warn the user that the simulation state will be destroyed:
simulation.reset
PS: Now I remember once, Matz half-jokingly said that he regrets that he introduces methods with kick in Ruby in general, because the kick is semantically so ambiguous.
Boris Stitnicky
source share