3 ms·
Multimethods are ambient actions. You could implement them with functions and any sort of type system. Maybe also a way to have variable-length parameter list
by lg 17y ago
Multimethods are ambient actions. You could implement them with functions and any sort of type system. Maybe also a way to have variable-length parameter lists. If that's OO then functional programming is object-oriented programming.
- xtho 17y agoMultimethods means that a method is dispatched not only on basis of the receveiving object (or read: first argument) but on basis of all arguments. The term is inherently related to OOP: http://en.wikipedia.org/wiki/Multimethod http://en.wikipedia.org/wiki/Multimethod
- jrockway 17y agoYes, functional programming is very similar to OO. OO: class SomeType { <data> ; SomeOtherType function1() { this.whatever ; ... } } FP: data SomeType ... f1 :: SomeType -> SomeOtherType f1 this = whatever this >> ... Same idea, different syntax. (Type classes will allow polymorphism, if that's what you're after.) You are thinking of the abstraction in terms of its implementation. There is no reason why a method in a class would physically be in that class; the class just acts as a namespace: class Foo { method } Foo.method(); and (defmethod Foo.method ...) (Foo.method) are the same.