From: David Garamond Date: 2004-01-13T18:32:30+09:00 Subject: Re: faster integer arithmetics & arbitrary precision floating number GGarramuno wrote: > I am still not 100% convinced that Ruby's feature of reopening base > classes is truly a benefit. Then don't use it :) > I see it as a long string of rope for > hanging yourself in the long run, perhaps. Yes, I'm wary of using it for larger projects. After all, interfaces should be as stable as possible for large software. But reopening classes is fun for small scripts. I use it all the time. For example, I want system() to be verbose (echo-ing what commands it's running) and raising an exception if the command failed. Instead of the usual (and plain): def my_system(cmd, *args); ...; end I can use the much cooler: module Kernel alias_method :orig_system, :system def system(cmd, *args) puts "Executing #{cmd}..." orig_system(cmd, *args) or raise ... end end and all my scripts can run with this unmodified! I also often open classes to modify its #to_s behaviour, etc. Another cool example is YAML's adding #to_yaml to all objects. Very convenient and feels natural... -- dave