Imho this depends a lot on what exactly is the domain meaning of the attributes/functio - would have to specify thata bit more
eg, those attributes could be all different formats of specifying a date - then you would want function to accept a single argument of type
X
, but could construct
X
with 3 different ways - either own
MyDate
class with 3 constructors or extension parser functions
Date.parse(String): Date
&
Date.parse(Int, Bool): Date
or it could be a function smth like
setJsonAttribute(name: String, value: ???)
- there it could be discussed between multiple overloads or
sealed class JsonValue
or maybe those union types
pretty sure I could think up more variants with different results... 😄