doppioh problem
awcoding opened this issue · comments
I had a problem with generating a native stub method using doppioh.
$ ./doppioh -classpath . -d natives/ classes/ns/Hello
/home/aw/doppio/node_modules/browserfs/dist/src/backend/ZipFS.ts:717
cb(new ZipTOC(index, cdEntries, eocd, data));
^
Error: Callback was already called.
at /home/aw/doppio/node_modules/async/dist/async.js:844:36
at /home/aw/doppio/src/classpath.ts:105:17
at Function.ZipFS.computeIndexResponsive (/home/aw/doppio/node_modules/browserfs/dist/src/backend/ZipFS.ts:717:7)
at Immediate._onImmediate (/home/aw/doppio/node_modules/browserfs/dist/src/backend/ZipFS.ts:714:15)
at tryOnImmediate (timers.js:543:15)
at processImmediate [as _immediateCallback] (timers.js:523:5)
PS ES6 Generators have started working for me lately in chrome. So I thought an approach like this (https://github.com/mozilla/task.js) might be of interest, for a potential solution to the browser api wrapping issue in doppio.
I have reproduced the issue; this looks like a bug.
Regarding task.js
, I'm not sure what exactly you mean. Generators expose a nice interface that might be useful for a native API one day, since you can "pause" a JavaScript function to wait for a DoppioJVM function call to return. But it's not fruitful to pursue them as the default solution until they are present in all web browsers and are fast.
@awcoding you need to use a package name, not a class name. The error message should be fixed, though.
Try: ./doppioh -classpath . -d natives/ classes/ns
@awcoding OK, I was wrong; the help text specified that class names should work. I found a bug that prevented it from working. This is now fixed in v0.4.2. Thanks for reporting!
Thanks for that. Sorry for the late response. I just got back from my vacation.
Is it meant to put more than:
registerNatives({
});
in the file? That's all I get.
BTW Regarding js generator support, I think it's in Chrome, FF & Microsoft Edge now. That's pretty good. I doubt it will get any better than that for the next 5 years.
Is it meant to put more than:
registerNatives({
});
in the file? That's all I get.
It will put that into a file if the classes you passed to doppioh
have no native methods. Are you sure your target classes/packages have native methods?
BTW Regarding js generator support, I think it's in Chrome, FF & Microsoft Edge now. That's pretty good. I doubt it will get any better than that for the next 5 years.
Oh, that's good progress. My next point still holds, though: They need to be relatively fast. I know that initial generator support limited their execution to JS interpreters, limiting their performance. The last I heard, FF and Chrome landed some initial JIT support, but the performance story isn't clear yet. I talked with the folks who work on Pyret who may evaluate a generator-based solution for their native JS functions; if it works out for them, maybe I'll look into using them in Doppio.
Oops, forgot my native keyword,. :)