In my description, I used the argument title instead parameter, sorry for this confusion.
On Wednesday, August 22, 2018 at 5:18:34 PM UTC+4:30, Jan Mercl wrote: > > On Wed, Aug 22, 2018 at 2:39 PM Masoud Ghorbani <msud.g...@gmail.com > <javascript:>> wrote: > > > Why there isn't function argument default value in Golang explicitly > like Typescript and Python? > > What are the possible benefits? The only things that come to my mind are > IMO negative. The definition of the default value is in a different place > than the call site is. It can be in a different file or even in a different > package. Go supports even binary-only packages, so the definition is > possible not available in source form at all. > > tl;dr: > > foo(42) > > says everything to know what the value passed to foo is. > > foo() > > does not and one has to lookup the definition of foo to see if foo has > zero parameters or one default parameter and then check what the default > value is. > > -- > > -j > -- 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. For more options, visit https://groups.google.com/d/optout.