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

Why named arguments? The parameters should show up in any decent editor showing their type and the name chosen by the implementor. The only reason I can think of for named arguments is to allow for default values to be left out of function calls, which just wouldn't fit in with Go.


The point of named arguments is to be more explicit at the call sites. It's also a way to be more robust against API changes -- you can add new optional named arguments or change their order, without breaking existing invocations. You can use named arguments to make a function interface with many optional arguments -- the kind of thing you would otherwise make a builder style interface for. But that's only the idea; Not saying it is necessarily a good idea to include named arguments.

Many people aren't using "decent text editors". vim isn't one. Webpages and prints of code chunks aren't. Information that you must inquire interactively is simply not the same as static information expressed inline in the code. Such is always a little more typing work but often it's worth it.




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

Search: