> The approach of the P language is weird (bad syntax for me) and *slow*. I think the syntax is down to the fact that it's not a real part of the language, hence all they could do was write code to fudge it, like I did. > If you really want to look at multi-methods, look at dylan or parasitic > method of j*v* When you say "j*v*" are you talking about some special language, or do you just not like writing that word? If the latter, what's a "parasitic" method? I've not seen that term used before. Never played with Dylan. One of these days, I guess I'll have to give it a go. > Just an example (it's important to see that next_method is a private > method) This code confused me. I didn't think you could have type specifiers like that in Ruby. Or is this Dylan or j*v*? It looks a lot like Ruby, but, as I say, I didn't know you could code methods like that. > > > pigeon% cat b.rb > #!./ruby > class AA < Array > end > > class A > def tt(Array a) > yield "Array" > next_method > end > def tt(AA a) > yield "AA" > next_method > end > def tt(String a) > yield "String" > next_method > end > > private > def tt(Enumerable a) > yield "Enumerable" > end > > end > > p A.instance_methods > p A.private_instance_methods > a = A.new > a.tt(AA.new 1, 2) {|i| puts "received #{i}" } a.tt("string") {|i| puts > "received #{i}" } a.tt(1 .. 2) > pigeon% > > pigeon% b.rb > ["tt"] > ["next_method", "tt"] > received AA > received Array > received Enumerable > received String > received Enumerable > /b.rb:31: private method `tt' called for #<A:0x401a5ba4> (NameError) > pigeon% > > > > Guy Decoux > >