Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reserved keyword bind breaks importcpp pragma #8728

Open
zacharycarter opened this issue Aug 22, 2018 · 2 comments
Open

Reserved keyword bind breaks importcpp pragma #8728

zacharycarter opened this issue Aug 22, 2018 · 2 comments

Comments

@zacharycarter
Copy link
Contributor

zacharycarter commented Aug 22, 2018

zachcarter@A-TX39FHTD6  ~/projects/sell-my-car-backend   master ●  nim -version
Nim Compiler Version 0.18.1 [MacOSX: amd64]
Compiled at 2018-08-22
Copyright (c) 2006-2018 by Andreas Rumpf

active boot switches: -d:release

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.

@LemonBoy
Copy link
Contributor

LemonBoy commented Sep 3, 2018

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.

@metagn
Copy link
Collaborator

metagn commented Apr 26, 2020

Now gives invalid pragma: importcpp: "bind". Maybe make it say invalid pragma for proc(): importcpp: "bind"?

Relevant else branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants