Open zacharycarter opened 6 years ago
Not quite, you just have to wrap with parentheses the return type (proc())
otherwise the importcpp
pragma is wrongfully attached to it rather than bindTo
.
Now gives invalid pragma: importcpp: "bind"
. Maybe make it say invalid pragma for proc(): importcpp: "bind"
?
import jsffi proc bindTo(p: proc(), self: JsObject, args: JsObject): proc() {. importcpp: "bind" .}
results in -
Error: attempting to call undeclared routine: 'importcpp
which is not very clear at all.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind#Syntax
https://nim-lang.org/docs/jsffi.html#bindMethod.m,typed - exists but users for the JS target are going to either desire a clearer error message here so they know they need to work around this with meta programming, or some type of implementation of bindMethod that also passes arguments to the closure.
Sorry if my summary of the issue was off - please edit to have it make sense.