On Sun, 10 Nov 2002 dblack / candle.superlink.net wrote:

[snip]
G> Interesting logic.... :-)
[snip]

ha ha.  hey, i *did* search for while... just didn't find it. ;-)

my news reader sux for searching, so i use google for that - any better ideas?

[snip]
> Why not:
>
>   self.class.new    # type is deprecated, I think, and the 'send'
>                     # is unnecessary
[snip]

just trying to make people notice/understand my meaning.  it worked...

[snip]
> I don't think it's a style question; it's really a question of what
> you want your method to do.  I think much/most of the discussion on
> this has revolved around the question of whether the behavior of the
> core classes is optimal in this regard.  When it comes to your own
> code, you can do whatever's best in a given case.
[snip]

i disagree here.  i love the open source mentality of ruby, the raa seems to
grow exponentially, and user classes can quickly become 'core' classes.  so
think it would be good if these 'style' issues could be hashed out.  like it
or not, the rididity and accepted 'standards' of java coding (like say
javadoc'ing your code) has definitely help the proliferation of third party
libraries.  being able to expect things from modules is a good thing IMHO.


[snip]
> Does that mean you would never override any method?  That seems awfully
> restrictive as a design principle.
[snip]

not at all...  but i do prefer

  class Child < Parent

    # original behavior extended
    def method(*args)
      super
      @sub_class_var = 42
    end

  end

to
  class Child < Parent

    # original behavior clobbered
    def method(*args)
      @sub_class_var = 42
    end

  end

when at all possible.

-a

-- 

 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================