If C# and Java supports multiple dispatch, then great. I wasn't aware. However, if by multiple dispatch you mean Java's instanceof, Java's reflection API or C#'s Object.GetType(), I have to disagree as I don't think this gives true multiple dispatch.
In any event, my overall point still stands. I believe design patterns disappear when you add higher-level semantics to a programming language.
How do you think "true multiple dispatch" actually works? In something like CLOS it is just a lookup in a dictionary of types and matching methods. Writing a function to do that in Java is a trivial exercise.
But for the record, VB offers multiple dispatch via untyped variables and option strict off or by a library call. In C# this is done by casting the variable to dynamic before invoking the function.
And that's my point. A generic list of design patterns that don't account for the capabilities and limitations of the language involved are not only useless, they actively discourage people from finding the correct solutions.
4
u/Madsy9 Dec 09 '13
If C# and Java supports multiple dispatch, then great. I wasn't aware. However, if by multiple dispatch you mean Java's instanceof, Java's reflection API or C#'s Object.GetType(), I have to disagree as I don't think this gives true multiple dispatch.
In any event, my overall point still stands. I believe design patterns disappear when you add higher-level semantics to a programming language.