Here's an idea for named arguments. Given: type fArg struct { x float64 y float64 i int }
func f(a fArg) { ... } func f2(a *fArg) { ... } ## Then, consider call example 1: f(x:1.9, i:2) -> this would be translated into an implicit struct creation either value or value plus a pointer: f(fArg{x:1.9, i:2}) ## call example 2: f2(x:1.9, i:2) -> is translated implicitly into f2(&fArg{x:1.9, i:2}) additional advantages: a) very easy to implement in the compiler; it is so simple that could almost be done with a macro. b) could be very useful in initializing structs too, using a simple helper function that also returned the structure: func helper(a *fArg) *Arg { return a } so that b := helper(i: 2) would give you the whole new &fArg{x:0, y:0, i:2} back in b. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/444577f7-9c1c-41d3-b1fc-fa5f4b40cf54%40googlegroups.com.