Hacker News new | ask | show | jobs
by arc776 1618 days ago
> Compare with dynamic languages (or structural typing, Go etc) that only care that things "quack like a duck".

Go is a statically typed language. Unless you're referring to interfaces at run time?

> I'm saying the function has 65 input parameters of all these specific types and nobody can call it now without providing them all. What a pain! Huge amount of extra code, refactoring, unit testing, because of this.

I've seen this "cambrian explosion of micro-types" argument before on HN but I think it comes from a misunderstanding about what you actually do in a static language. No one's creating types for every combination of parameters.

Either you'd pass the two arguments directly (`a, b: int` or whatnot), or you'd pass the Order type and just use the bits you need.

If you have multiple Order types, you'd use generics or something like it to get duck typing. If you used a field that wasn't there, you'd get a compile error.

The reality is the code would look pretty much the same in both static or dynamic languages.