proposal: spec: Allow passing more arguments to variadic functions with final argv...
#21388
Labels
Milestone
argv...
#21388
Hello up there. Currently the following does not compile:
and gives
to make it work one has to change myprint as follows:
which adds much noise to actual signal.
For variadic functions the language already implicitly allocates argv slice as it happens e.g. in the following log.Print call:
So from this point of view implicitly allocating new
argv2 = append([]interface{}{subject}, argv...)
for(subject, argv...)
case should be consistent.I propose: for variadic functions with signature
...T
allow merging extra arguments with finalargv...
if all extra arguments are assignable to T and argv is assignable to []T. If both extra argumens and finalargv...
are present, a new []T slice is allocated and passed to called function. The content of passed slice isappend([]T{extra1, extra2, ..., extraN}, argv...)
.Thanks beforehand,
Kirill
The text was updated successfully, but these errors were encountered: