Closed wheakerd closed 6 months ago
New functionality is developed and expanded by developers and follows PHP versions. If we only focus on PHP's greater support for extensions, is it unnecessary to spend too much energy maintaining and developing extensions?
Description
Must C language be used for PHP extension development? PHP/Java Bridge Would it be better to use php?
An extension, in the common sense, needs to use a language capable to call the Zend C api. This PHP/Java Bridge, in my view, does not fall into this category.
There are a couple of reasons to implement PHP extensions:
I don't think Java is a good fit for either of those. There have been suggestions to integrate a more modern language, but it would most likely need to be something more low-level (e.g. Rust or Zig) that can be used not only for extensions but also the core engine. Either way, integrating another language will be a substantial amount of work.
Isn't it necessary to implement performance-critical code in a faster language and use PHP language to implement extensions, plus compilation? The rust language is less friendly to PHP developers than the C language! As PHP developers, we hope to use the PHP language to complete an extension, and Java does exactly that!
Java and Python, PHP, C # Net, Node, and others are high-level languages, while RUST, C, C++, assembly language, machine language, and microcode are low-level languages that tend to interact with computer hardware and are usually closer to the underlying computer than high-level programming languages. So as a backend developer? We should not spend more energy and cost on learning these.
I have done my share on Java/JNI, C# bindings to C ... and it takes a lot more work to make it happen than "just do it already" ; not counting the maintenance over time with changes of interfaces and so on .. However, if that appeals to you, I suggest you expand on your case on the internal mailing list internals at lists.php.net
I agree with @devnexen. Interop between languages isn't simple. Java has its own runtime, which will need to be bridged, which has a performance penalty. Also note that the PHP engine isn't just complex because it's C (C is a very simple language), but because interpreters are inherently complex, and because the language has its fair share of legacy. Wrapping the same C constructs in Java isn't really going to make things simpler. Instead, you'll need to write memory-unsafe things in C and call them from Java, which really defeats the purpose of your suggestion.
Anyway, if you still think using Java for extensions is a good idea, please send an e-mail to the mailing list, outlining how that would work, and what benefits it provides over C.
Description
Must C language be used for PHP extension development? PHP/Java Bridge Would it be better to use php?