>>>>> "S" == Stephen White <spwhite / chariot.net.au> writes:

S> Besides, defining multiple functions with the same name uses the same
S> amount of space as writing a case statement.

 Sometimes space is not important

pigeon% cat b.rb
#!./ruby
class AA < Array
end

module B
   def tt(AA a)
   end
end

class A
   include B
   def tt(Array a)
   end
end
pigeon% 

pigeon% b.rb
./b.rb:12: Possible ambiguous call B [AA] -- A [Array] (NameError)
pigeon% 

S> and has the same meaning anyway. I'd rather modify a list of items in
S> a case statement than a list of function declarations. The case list is
S> grouped together, the declarations can appear anywhere.

 Do it with your case.

S> For Ruby to support static typing as well as dynamic typing would mean
S> writing two parallel infrastructures. Code that communicates through
S> defined methods (now) and code that communicates through type systems.

 This is not static typing.


S> Eg, a library that dispatches on types would stop me doing things like:

S>   class Whatever
S>     def puts *args
S>     end
S>   end

S> then making a call to the library... since it will no longer recognise
S> what is being passed to it, whereas a Ruby library will just make the
S> call to my defined version of puts.

 Well, I know that I use a strange rule actually for this case :-))

pigeon% cat b.rb
#!./ruby
module B
   def tt(*a)
   end
end

class A
   include B
   def tt(Array a)
   end
end
pigeon%
 
pigeon% b.rb
pigeon% 

 but

pigeon% cat b.rb
#!./ruby
module B
   def tt(Array a)
   end
end

class A
   include B
   def tt(*a)
   end
end
pigeon% 

pigeon% b.rb
./b.rb:9: Redefining a Generic method in Object with a non-Generic method for tt (NameError)
pigeon% 


Guy Decoux