Разработчики голанга утверждают, что такое поведение, это не бага а фича.
Мотивируют так:
But let’s say that you’re using someone else’s library, and you do
Foo(f1(), f2(), f3(), f4(), f5(), f6(), f7(), f8(), f9(), f10())
And the developer of f9() changes the number of values returned. Foo() now reports that you have too many or too few arguments, and you have to check 10 different places and remember how each of them are supposed to match Foo()’s parameters.
Or worse: the compiler doesn’t report an error (Foo() takes a variadic
argument) and your code silently breaks
Мотивировка, конечно, понятная, но как по мне — так это просто косяк при проектировании языка.
Originally published at U.F.M's Homepage. You can comment here or there.
(no subject)
Date: 2014-04-19 15:57 (UTC)(no subject)
Date: 2014-04-19 16:11 (UTC)(no subject)
Date: 2014-04-19 16:19 (UTC)(no subject)
Date: 2014-04-19 16:34 (UTC)