2 ms·
I think the closest equivalent in Java or C# would be to use reflection to pull out the Swim and Quack methods.
by dilap 2y ago
I think the closest equivalent in Java or C# would be to use reflection to pull out the Swim and Quack methods.
- mseepgood 2y agoIn C# you would simply use the 'dynamic' keyword.
- neonsunset 2y agoAnd get yelled at by your colleagues ;D In practice, the use of dynamic is highly discouraged as well as anything that could lead to type confusion i.e. currently discussed Go's duck typing it calls structural (runtime vs static is impl. detail). Instead, you are expected to simply do 'lessSpecific is IMoreSpecific ms`, works particularly well with pattern matching on switches for functional style.
- dilap 2y agoha totally forgot about that! what a crazy feature. i wonder if anyone uses it in the wild?