Ruby handles this by putting such functions on its IO class as instance 
methods, and then defining global functions that are just aliases to more 
verbosely calling instance methods on global IO objects. For instance, puts is 
just an alias to $stdout.puts, gets is just an alias to $stdin.gets, etc. That 
way, people who want to type as little as possible to write Hello World 
programs are happy, and people who want a consistent object-oriented syntax and 
the benefits of polymorphism are also happy. Everyone is happy!

Reply via email to