Duck-typing allows deeper polymorphism

> Not entirely true... The argument 'x' must also respond to whatever
> parseargs wants from it (respond_to?, I assume), whatever the 'pa.x' method
> wants from it (well, nothing, I assume), and whatever 'p' wants from it
> (to_s, I assume).

sure - everything in :ducktype=>list AND what parseargs needs - quite true.

Not just parseargs, but any other methods that the method calls. In your case, it was simply p, but in some other case, I might be passing a parameter all around the system, in which case, who knows what it'll need. (Is that bad design? If so, that's precisely one of the things I want to flesh out as an extra restriction we need to place on ourselves because we're using Ruby.)

>> note that this could be parsed via rdoc quite easily.
> Only if it's an Array literal being passed to parseargs.
huh?

def method(*argv)
  pa = parseargs(argv){
    arg :x, :ducktype => File.new('methods.txt').readlines.each { |line|
      line.chomp
    }
  }
  p pa.x.upcase.downcase
end

we're all friends here so i assume people will offer up any criticisms come to
mind.

Ok. Thanks!

Devin

ah. true true. at least the docs could show the rhs of the '=>' sign which
would, in 99% of cases, but quite informative.

cheers.

-a

ยทยทยท

On Sat, 11 Jun 2005 twifkak@comcast.net wrote:

Not entirely true... The argument 'x' must also respond to whatever
parseargs wants from it (respond_to?, I assume), whatever the 'pa.x' method
wants from it (well, nothing, I assume), and whatever 'p' wants from it
(to_s, I assume).

sure - everything in :ducktype=>list AND what parseargs needs - quite true.

Not just parseargs, but any other methods that the method calls. In your case, it was simply p, but in some other case, I might be passing a parameter all around the system, in which case, who knows what it'll need. (Is that bad design? If so, that's precisely one of the things I want to flesh out as an extra restriction we need to place on ourselves because we're using Ruby.)

note that this could be parsed via rdoc quite easily.

Only if it's an Array literal being passed to parseargs.

huh?

def method(*argv)
pa = parseargs(argv){
   arg :x, :ducktype => File.new('methods.txt').readlines.each { |line|
     line.chomp
   }
}
p pa.x.upcase.downcase
end

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
My religion is very simple. My religion is kindness.
--Tenzin Gyatso

===============================================================================