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

Macro annotation could generate singletons, object literals, functions, too #18

Open
nafg opened this issue Oct 25, 2013 · 1 comment
Open

Comments

@nafg
Copy link

nafg commented Oct 25, 2013

...so that they can be used in scala, and rendered to javascript.

This would require a different approach than adding a method to the companion object, like the one I described here: https://groups.google.com/d/msg/jscala-user/b8QV0oofg3c/w_95Bjx7GQ0J

@nafg
Copy link
Author

nafg commented Oct 25, 2013

Alternatively, jscala might push all annotated definitions to a queue, and then the application could just output all the definitions in bulk, without having to request them by name.
Another approach would be, a(n alternative) javascript { } block would return not only the AST, but also a list of dependencies invoked inside it. Dependencies would have some unique id so that you could output them only once per scope. The downside of this is you aren't informed of the dependencies until you invoke them, so if you use it in an ajax response you'd have to add the dep to the page then, rather than the page referring to the dep to begin with.

In either case tracking definition usages needs to be scoped, preferably statically via an implicit Scope instance. (There could be a global default for simple applications.)

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

No branches or pull requests

1 participant