Why is there a "new" keyword in Go?
- by dystroy
I'm still puzzled as why we have new in Go.
&Thing{} is as clear and concise as new(Thing) to Go coders and it uses only constructs you often use elsewhere. It's also more extensible as you might change it to &Thing{3} or &Thing{Feets:7}.
In my opinion, having a supplementary keyword is costly, it makes the language more complex and adds to what you must know. And it might mask to newcomers what's behind instantiating a struct. It also makes one more reserved word.
So what's the reasoning behind new ? Is it something useful ? Should we use it ?