You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
could load the Julia package, and scan the exported symbols from a julia package, creating them as exports, so that then you could just natively write
package.my_function("my", "JavaScript", "values")
This would enable much more native Julia integration
Since the smarts of function dispatch is done dynamically anyway, it seems like this would involve little more than scanning all the symbols exports and creating functions for each, vaguely like this.
foreach(exported_symbol in package)
function exported_symbol(args) { return julia.exec(exported_symbol, args); }
The text was updated successfully, but these errors were encountered:
sebastiang
changed the title
Export Julia modules as JavaScript (CommonJS) modules
Export Julia packages as JavaScript (CommonJS) modules
Feb 27, 2015
As described above, there is now added functionality for importing julia modules. The syntax is
julia.import(modulename); and then subsequently the exported function can be used directly. So for example, using Julia's JSON package, one can do the following (in a file called index.js)
var julia = require('node-julia');
var juliaJSON = julia.import('JSON');
// Create a JRef of a Julia Dict then export that JSON of
// the Dict, but Julia exports this as a string, so then
// use JSON.parse on the output.
var x = julia.eval('Dict("a" => "b")');
var y = juliaJSON.json(x);
console.log(JSON.parse(y));
var package = julia.using('Package')
could load the Julia package, and scan the exported symbols from a julia package, creating them as exports, so that then you could just natively write
package.my_function("my", "JavaScript", "values")
This would enable much more native Julia integration
Since the smarts of function dispatch is done dynamically anyway, it seems like this would involve little more than scanning all the symbols exports and creating functions for each, vaguely like this.
The text was updated successfully, but these errors were encountered: