Re: Publishing Checkout Finland API Client to PECL
| From: | Johannes Schlüter | Date: | Thu, 09 Nov 2017 12:23:31 +0000 |
| Subject: | Re: Publishing Checkout Finland API Client to PECL | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-14941@lists.php.net to get a copy of this message | ||
On Do, 2017-11-09 at 01:20 -0700, Thomas Hruska wrote:
> > Any ideas if this could be published?
> I'm not in charge of PECL accounts, but I'm wondering what the
> benefit of this extension is instead of a simple userland
> library? Looks like it just calls cURL/file_get_contents().
Right, doing stuff in Extensions should only be done for
* Educational purpose (very good reason to write extensions, in order
to learn how PHP works!)
* To access a system library
* Performance tuning (less relevant with PHP 7 than in old days)
As extensions are harder to deploy, harder to maintain, harder to debug
etc.
> Aside from whether or not it is a good candidate for PECL, your
> extension source code has a lot of spurious whitespace/alignment
> issues
> and several variable name issues (e.g. naming a variable __$true
> isn't
> particularly good C style code).
>
I never heard of zephir before, but the code looks like it is
generated. Looking into the provided zaphir files this has only limited
quality (i.e. I notice it's using zend_error, which is only to be used
in the engine, it uses E_ERROR which should only be used for non
recoverable situations, ...)
Also the generated code has weirdness like variables with numbered
names (variables starting with __ are not only bad way, but plain
invalid per §7.1.3 of the ISO C standard "All identifiers that begin
with an underscore and [...] another underscore are always reserved for
any use.") and is simply calling user-level functions instead of using
the C APIs. This could even be slower than using PHP where the engine
can eventually optimize variable usage etc. while otherwise doing
almost the same thing ...
So, sorry, but I'm strong -1 for inclusion of this.
johannes