Shannon Fang <xrfang / hotmail.com> wrote:
> The problem here is, we have seen some Ruby methods, like String.chomp!
> and many that end with a !, they can modify parameters in place, how is
> it done?? Is it possible to do this in programming, or is it only
> available in standard libraries, which may be implemented outside of
> ruby (eg. in C)?

Hi,

In general, for the Ruby built-in classes such as String, the methods are
indeed implemented in C.  For your own classes, probably it suffices to
say that you cannot modify 'self' (such as 'self = something') in Ruby,
but it is possible do that through the Ruby C API's.

Ruby restricts you from doing certain operations, but if you also use the
Ruby C API's, as the pickaxe book says, "the possibilities are
endless" (not mentioning if you also start to modify the Ruby source code 
itself for your own personal library...)

Regards,

Bill