4 ms·
> That's not true, you can always have a "send_message(string id)". Few people do it because you lose static type safety. And some languages, like C# and Scala,
by foobar_ 7y ago
> That's not true, you can always have a "send_message(string id)". Few people do it because you lose static type safety. And some languages, like C# and Scala, have dynamic types that allows for the "method_missing" protocol and such features are very unpopular.
That is the difference. If every class in C++ had only one method - send_message and each object is an independent thread, you will get how Erlang works. That is how you would do the actor model in C++.
Inheritance, Polymorphism is emphasised in Java, C++ and C#, whereas Functional programmers emphasise function objects / lambdas / Command Pattern where you just have one method - calling the function. Infact having just method you no longer need Polymorphism / Interfaces.
- bad_user 7y agoWhat? This has nothing to do with functional programming. FP needs polymorphism too and as a matter of fact FP tends to be even more static. In FP we have type classes, built via OOP in static OOP languages. > Infact having just method you no longer need Polymorphism / Interfaces. That’s false.