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

Support native extensions #108

Closed
mikedanese opened this issue Feb 18, 2016 · 4 comments
Closed

Support native extensions #108

mikedanese opened this issue Feb 18, 2016 · 4 comments

Comments

@mikedanese
Copy link
Contributor

local nativeExtension = import src/jsonnet_regexp.h;

dlopens a libarary, calls jsonnet_regexp_registered_functions() (or some other well-known name), which returns a list of builtins to register and declare in the nativeExtension object.

@sparkprime
Copy link
Contributor

That's very specific to the implementation language (C++).

But we could do is something like
std.builtin("foo")
and require the application code linking the jsonnet library to provide callbacks (just like we already allow import callbacks for doing I/O).

There is already an AST node for builtins, but it is only introduced during desugaring, it is not part of the actual syntax of the language. We could make it part of the actual syntax and allow adding more builtins as well.

@davidzchen davidzchen added the rfc label Mar 8, 2016
sparkprime added a commit to sparkprime/jsonnet that referenced this issue May 28, 2016
@sparkprime
Copy link
Contributor

Example here: https://gist.github.com/sparkprime/5b2ab0a1b72beceab2cf5ea524db228c

@mikedanese
Copy link
Contributor Author

This is awesome!

@vitiral
Copy link

vitiral commented Oct 12, 2018

I think this is related: https://groups.google.com/forum/#!topic/jsonnet/OhWV2RKlUFE

I didn't see this documented at all in the standard library so I started that thread. Also, I still don't see any documentation about "std.native"

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