Does this issue reproduce with the latest release?
Yes.
syscall.NewCallback (and syscall.NewCallbackCDecl) don't describe what's expected of the type of their argument beyond "it must be a function". But they do have requirements. For example, if you pass a function with no argument and no results, they panic with "compileCallback: function must have one output parameter". I don't actually know what this means a priori, and the NewCallback documentation doesn't tell me. The term "output parameter" doesn't appear in the Go spec, and it could (and does in this case) mean a result value, or it could mean a C-style output parameter which is actually an input argument that points to where to put the result.
We should document NewCallback*'s requirements and clarify the panic message for when they're violated.
Ah, "output parameter" appears in the reflect documentation, which is probably where this terminology came from. That may be a bug in the reflect package documentation. :)
What version of Go are you using (
go version
)?Tip (commit 65d55a1)
Does this issue reproduce with the latest release?
Yes.
syscall.NewCallback
(andsyscall.NewCallbackCDecl
) don't describe what's expected of the type of their argument beyond "it must be a function". But they do have requirements. For example, if you pass a function with no argument and no results, they panic with "compileCallback: function must have one output parameter". I don't actually know what this means a priori, and theNewCallback
documentation doesn't tell me. The term "output parameter" doesn't appear in the Go spec, and it could (and does in this case) mean a result value, or it could mean a C-style output parameter which is actually an input argument that points to where to put the result.We should document
NewCallback*
's requirements and clarify the panic message for when they're violated./cc @alexbrainman
The text was updated successfully, but these errors were encountered: