Hacker News new | ask | show | jobs
by mountainriver 1597 days ago
I would really love to see default parameters and struct values. I jump between Python and Go in my day job and Go is a much better language overall but things like this make it painful
2 comments

This is also my #1.

Parameter / Option ergonomics.

The current best practice of "functional options" and long function chains results in far too many function stubs ... its a minimum of 3 extra lines per parameter. Parameter structs require a whole extra struct...

Borrowing optional / named parameters from Python would cut down length and complexity of Go code drastically.

Default parameters have always struck me as dangerous. (And for my day job I use Python.)
I always hear this argument but I’ve never seen it be dangerous in my day to day. We deal with defaults all the time in programming and it’s generally fine