Re: Operator Overloading <<



--- Austin Ziegler <halostatue@xxxxxxxxx> wrote:
> Sorry, but this really doesn't have anything to do with my
> statement.
> One shouldn't inherit from Array, String, and Hash in Ruby
> because there
> are certain things that Don't Work the way that you'd expect
> them to
> because they are written in the C side.

In addition to this, I'd also say be very careful about
redefining methods in core classes. Same reason - they are
written in C. Many times the C code bypasses the standard
method call mechanism and calls other C code methods directly
so if you redefine you may not get what you want. An extreme
example is Regexp#=~. See what happens when you try to
override it - you'll get inconsistent results even if only ruby
code calls it.




__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com


.



Relevant Pages

  • Ruby hashes
    ... Is there a way in Ruby to pass a hash value from string to ... An array of objects Teacher, each with his name and belonging ...
    (comp.lang.ruby)
  • hash with files
    ... Goal ==> get file sizes stored in hash from Dir.glob ... $ ruby test.rb ... apparently my hash value has to be converted to a string b4 testing it ... Wonder if I have to use dirhsh.inspect to convert it to a string first? ...
    (comp.lang.ruby)
  • Re: cant convert Hash into String
    ... It looks like address is a String ... You are trying to do string + hash, which doesn't make sense (and that's ... what Ruby is telling you) ... Without seeing the contents of the 'hotel' object, ...
    (comp.lang.ruby)
  • Re: using lambda/Proc can prevent a lot of garbage collection
    ... >>> Ruby from excluding unbound variables in closures. ... >> context. ... > needed a string based eval. ... blocks can be used to create local variables (as ...
    (comp.lang.ruby)
  • Re: Euler problem #22
    ... For each repetitive sort of problem, ... Ruby comes with a set of tools like that. ... accept as many buffers as you want but at any given time you have one ... string, and -ALLOT to release your scratch buffers, and you're done. ...
    (comp.lang.forth)