psychoslave / englishest

A Ruby gem which allows a more literate coding style
MIT License
0 stars 0 forks source link

Use a singleton to contain the stashed $_ value #3

Open psychoslave opened 2 years ago

psychoslave commented 2 years ago

cf https://rubyreferences.github.io/rubyref/stdlib/patterns/singleton.html

psychoslave commented 2 years ago

On the other hand, this might well be one of this rare case where a global value might be justified: few chance of collision, the variable designed to be automatically assigned in a single point of code, and the impact on performance might be significant on large amount of batch substitution.