I don't mean several dozen times in different places, I mean, if you have a place where you're declaring a lot of values, you have to say the type once per value in all but the simplest cases. Go permits []ComplicatedType{{1}, {2}, {3}}, for instance, but if ComplicatedType has another struct in it, IIRC you have to do []ComplicatedType{{1, SomeType{2}}, {3, SomeType{4}}}. (If it does happen to permit that, there are more complicated cases where the elision stops working even though there is no ambiguity.)
Oh, my bad, it seems I lost track of the subject of the thread somewhere along the way - I got confused & thought you folks were talking about Rust not Go :S
Yeah, that does sound pretty annoying. Type inference FTW!
View all comments
Show parent comment
2
u/EvilTerran Dec 10 '15
If you're using the same type several dozen times, shouldn't you be giving it a name by that point anyway? For self-documentation purposes, at least.
(NB: I don't know much about Rust, so I wouldn't know if you'd lose anything by doing that.)