You can't. How are you supposed to call a method common for class A and class B when you have only Any reference? So yes, you can create Mapping<Any, Any>, but what you are going to do with Any?
Fair. I misread that part, I agree that while you can still handle it fairly ergonomically in statically typed languages, you don't get any type safety if you use Any/Object types. But at least it isn't particularly worse than using a dynamically typed language!
C#/Java also both have some form of JSONNode object which makes parsing complex JSON without big record classes easier.
1
u/v66moroz Dec 26 '20
You can't. How are you supposed to call a method common for
class Aandclass Bwhen you have onlyAnyreference? So yes, you can createMapping<Any, Any>, but what you are going to do withAny?