pib icon indicating copy to clipboard operation
pib copied to clipboard

Usage in Iodide

Open filips123 opened this issue 5 years ago • 1 comments

It would be great to use PHP in Iodide. It also uses languages (currently only Python) that are compiled to WebAssembly so it should not be hard to do this.

For details how to do this see iodide-project/iodide#1637.

filips123 avatar Mar 16 '19 20:03 filips123

@oraoto I started implementing a PHP plugin. You can see discussion in iodide-project/iodide#1637. I have a few questions and I need some help from someone that knows how exactly PIB works :)


From https://github.com/iodide-project/iodide/issues/1637#issuecomment-474011335:

The evaluate function should return the return value of whatever is run, not just a success/fail. If that is what the PHP wasm library you are using does, that would have to be changed in order to the get the return value out.

Iodide expects that evaluate function (which calls phpModule.ccall and executes code) return the return value of script. The problem is that currently just returns 0 of execution is OK and -1 of it is wrong.

So, phpModule.ccall would need to be changed to return the return value. Another possible solution would be to get it from another source.


From https://github.com/iodide-project/iodide/issues/1637#issuecomment-473894139:

To answer your question about how Level 2 can be acheived: that's very specific on the implementation of the language itself. In Python, for example, there is a whole C API to handle Python data types, and this can be used (and even called directly from Javascript) to convert Python data types to Javascript data types. I don't know anything about the implementation of PHP, but if you're lucky, it has something similar. You can look here for how that's done in Python, but it would mostly have to be converted to PHP-specific calls.

Is it possible to handle PHP data types, like in Python? How can this be done?

filips123 avatar Mar 22 '19 19:03 filips123