Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When people say "duck typing" they mean structural typing almost universally. You're not going to change them to use your terminology.

Also, names are just shorthand in Go; Interfaces can be declared and used at point of declaration, and structural typing applies to them just as well.



> When people say "duck typing" they mean structural typing almost universally. You're not going to change them to use your terminology.

No, when people say "duck typing" they're talking about dynamically typed languages which blow up at runtime or perform runtime tests on existing property. That is duck-typing, it does not take in account things like parameters or return types and it doesn't blow up at parse time.

> Also, names are just shorthand in Go;

It's not a shorthand when you have to use them (I don't know if Go can infer structural types)


> No, when people say "duck typing" they're talking about dynamically typed languages

No, they're not. Explain OCaml's object system to any Ruby or Python programmer and they'll say, "Oh, it's duck typed?" Why do you think so many programmers (such as the one you "corrected" above) use the term "duck typing" for Go? Because they mean structural subtyping. Why do you think c2.com's wiki[0] gives OCaml and C++ template as examples of static duck typing? Because they are. Duck typing (like strong/weak typing) is entirely orthogonal to whether the typing is done statically or dynamically.

You don't have to use interface names in Go. Anywhere you type a name like "io.Reader" you can type the full "interface { ... }" declaration. It sounds like you're confusing type inference with nominal typing.

[0] http://c2.com/cgi/wiki?DuckTyping




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: