|
|
|
|
|
by frankpf
3018 days ago
|
|
IMO, having functions that accept different types (when the types are unrelated) is an anti-pattern in most cases, it doesn't matter if you make it more "maintainable" by using single dispatch. It's fine when you have related types, but in the example
`someFunction` accepts both ThisClass and str, which (I assume) have very different functionality. You see this anti-pattern a lot in dynamically-typed languages. As an example, both these examples are valid and do the same thing in `knex`, an SQL query builder for node: knex.select('name', 'email').from('users')
knex.select(['name', 'email']).from('users')
|
|