Feature request: support writing PHP extensions


#1

There are such ability in PHP as writing extensions with C. Also there are such language as Zephir created to simplify developing PHP extensions.
I think, Kotlin could replace Zephir.
There are one try to implement this idea: Part1, Part2, Part3. The result of this try was creation of the Kotlin Native PHP extension generator. But developer, who create this PHP extension generator experienced a large number of difficulties on his way and there are no guarantees that the generator works qualitatively and will support.
Summary. PHP is one of the most popular server-side languages. A lot of projects could get a lot of performance by PHP extensions written with Kotlin/Native. PHP - is yet another platform for Kotlin code-sharing. Kotlin community can be extended by Web/PHP developers. So it would be great if such ability will support by Kotlin team.
Also such functionality could be added to PhpStorm. For example, PHP-developer could write some code, which need performance directly in PhpStorm.


#2

I was with you until there. What about Postgres extensions too? Maybe Node native modules? Python extensions? …all could have benefits written in Kotlin (and issues compared to a language like Rust which may be more amenable), but it’s not something that should be done by the Kotlin team IMO.


#3

Postgres, Node, Python are very popular “platforms”. So of course such ability should have support by Kotlin team too. First of all it is cheap (in most cases nothing should be done or something should be done once), but efficiency is much greater (Kotlin will became more popular).
I mentioned PHP because writing extensions for it with Kotlin, don’t work “out of the box”, because PHP extensions API based on macros.
Does you have any difficulties writing extensions for Postgres, Node or Python with Kotlin? Maybe it works without workaround…
I want to note, we are not talking about the development of another language, but only about “a small drop of glue”. And we are talking only about very popular platforms, like PHP, Node and Python.
Kotlin is positioned as a multiplatform language. Being such in theory and in practice are two different things.