Re: [PHP-DEV] About SUCCESS/FAILURE

2015-01-05 Thread Julien Pauli
On Sat, Dec 27, 2014 at 4:45 AM, Pierre Joye pierre@gmail.com wrote: On Dec 26, 2014 7:42 PM, Xinchen Hui larue...@php.net wrote: Hey: On Fri, Dec 26, 2014 at 7:54 PM, Andrea Faulds a...@ajf.me wrote: On 26 Dec 2014, at 05:57, Levi Morrison le...@php.net wrote: On Thu,

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-26 Thread Andrea Faulds
On 26 Dec 2014, at 05:57, Levi Morrison le...@php.net wrote: On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner m...@php.net wrote: There's already ZEND_RESULT_CODE, or did I miss anything? According to lxr.php.net, this symbol ZEND_RESULT_CODE is not referenced in any place except its

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-26 Thread Xinchen Hui
Hey: On Fri, Dec 26, 2014 at 7:54 PM, Andrea Faulds a...@ajf.me wrote: On 26 Dec 2014, at 05:57, Levi Morrison le...@php.net wrote: On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner m...@php.net wrote: There's already ZEND_RESULT_CODE, or did I miss anything? According to lxr.php.net, this

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-26 Thread Levi Morrison
On Fri, Dec 26, 2014 at 5:42 AM, Xinchen Hui larue...@php.net wrote: Hey: On Fri, Dec 26, 2014 at 7:54 PM, Andrea Faulds a...@ajf.me wrote: On 26 Dec 2014, at 05:57, Levi Morrison le...@php.net wrote: On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner m...@php.net wrote: There's already

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-26 Thread Pierre Joye
On Dec 26, 2014 7:42 PM, Xinchen Hui larue...@php.net wrote: Hey: On Fri, Dec 26, 2014 at 7:54 PM, Andrea Faulds a...@ajf.me wrote: On 26 Dec 2014, at 05:57, Levi Morrison le...@php.net wrote: On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner m...@php.net wrote: There's already

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-25 Thread Michael Wallner
There's already ZEND_RESULT_CODE, or did I miss anything? On 25 Dec 2014 06:45, Xinchen Hui larue...@php.net wrote: Hey: On Thu, Dec 25, 2014 at 12:38 PM, Pierre Joye pierre@gmail.com wrote: On Thu, Dec 25, 2014 at 3:06 PM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 23:53,

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-25 Thread Pierre Joye
On Fri, Dec 26, 2014 at 8:33 AM, Michael Wallner m...@php.net wrote: There's already ZEND_RESULT_CODE, or did I miss anything? Yes, to read the thread :) We are not talking about the lack of a status typedef but about the inconsistencies across PHP internal APIs. And what Xinchen suggests below

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-25 Thread Levi Morrison
On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner m...@php.net wrote: There's already ZEND_RESULT_CODE, or did I miss anything? According to lxr.php.net, this symbol ZEND_RESULT_CODE is not referenced in any place except its definition. We can begin using it if we like, or even rename it.

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-25 Thread Xinchen Hui
Hey: On Fri, Dec 26, 2014 at 5:33 AM, Michael Wallner m...@php.net wrote: There's already ZEND_RESULT_CODE, or did I miss anything? yes, we were talking about use ZEND_RESULT_CODE as return type hinting for those functions use SUCCSS/FAILURE .. furthermore, maybe we could use it as all

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
Hey: On Wed, Dec 24, 2014 at 3:38 PM, Stanislav Malyshev smalys...@gmail.com wrote: Hi! But: return 0 and return FAILURE... which is simpler? It's equally simple to write, but FAILURE of course is way simpler to understand when read. I can not agree with that since nowdays, false === 0,

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
On Wed, Dec 24, 2014 at 3:57 PM, Pierre Joye pierre@gmail.com wrote: On Dec 24, 2014 2:38 PM, Stanislav Malyshev smalys...@gmail.com wrote: Hi! But: return 0 and return FAILURE... which is simpler? It's equally simple to write, but FAILURE of course is way simpler to understand when

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Wed, Dec 24, 2014 at 7:53 PM, Xinchen Hui larue...@php.net wrote: On Wed, Dec 24, 2014 at 3:57 PM, Pierre Joye pierre@gmail.com wrote: On Dec 24, 2014 2:38 PM, Stanislav Malyshev smalys...@gmail.com wrote: Hi! But: return 0 and return FAILURE... which is simpler? It's equally

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Johannes Schlüter
On Wed, 2014-12-24 at 05:06 +, Andrea Faulds wrote: typedef enum _zend_success { FAILURE = 0, SUCCESS = 1 } zend_success; mysqlnd uses a enum for that already. See http://lxr.php.net/xref/PHP_TRUNK/ext/mysqlnd/mysqlnd_enum_n_def.h#139 If a PHP-wide thing is introduced this should

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Dec 24, 2014 8:41 PM, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2014-12-24 at 05:06 +, Andrea Faulds wrote: typedef enum _zend_success { FAILURE = 0, SUCCESS = 1 } zend_success; mysqlnd uses a enum for that already. See

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Levi Morrison
Hmm. This thread doesn't seem to mention it, but why must failure be negative? I understand the non-zero part but not negative. Aside from the fact we probably have code relying on it to be negative at this point is there some other reason? -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Andrea Faulds
On 24 Dec 2014, at 17:22, Levi Morrison le...@php.net wrote: Hmm. This thread doesn't seem to mention it, but why must failure be negative? I understand the non-zero part but not negative. Aside from the fact we probably have code relying on it to be negative at this point is there some

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Levi Morrison
On Wed, Dec 24, 2014 at 10:34 AM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 17:22, Levi Morrison le...@php.net wrote: Hmm. This thread doesn't seem to mention it, but why must failure be negative? I understand the non-zero part but not negative. Aside from the fact we probably have

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Dec 25, 2014 1:13 AM, Levi Morrison le...@php.net wrote: On Wed, Dec 24, 2014 at 10:34 AM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 17:22, Levi Morrison le...@php.net wrote: Hmm. This thread doesn't seem to mention it, but why must failure be negative? I understand the

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Andrea Faulds
On 24 Dec 2014, at 18:13, Levi Morrison le...@php.net wrote: On Wed, Dec 24, 2014 at 10:34 AM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 17:22, Levi Morrison le...@php.net wrote: Hmm. This thread doesn't seem to mention it, but why must failure be negative? I understand the

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Johannes Schlüter
On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wrote: I'm asking for specific things. The reason is that some API's do a non-zero error code; the fact that they are negative is a detail that we should not need to care about. My guess is that positive values more often might have a meaning

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Levi Morrison
On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wrote: I'm asking for specific things. The reason is that some API's do a non-zero error code; the fact that they are negative is a detail that we should not need

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Andrea Faulds
On 24 Dec 2014, at 23:53, Levi Morrison le...@php.net wrote: On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wrote: I'm asking for specific things. The reason is that some API's do a non-zero error code;

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
Hey: On Thu, Dec 25, 2014 at 12:06 PM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 23:53, Levi Morrison le...@php.net wrote: On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wrote: I'm asking for

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Thu, Dec 25, 2014 at 3:06 PM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 23:53, Levi Morrison le...@php.net wrote: On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wrote: I'm asking for specific

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Thu, Dec 25, 2014 at 3:34 PM, Xinchen Hui larue...@php.net wrote: Hey: On Thu, Dec 25, 2014 at 12:06 PM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 23:53, Levi Morrison le...@php.net wrote: On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter johan...@schlueters.de wrote: On

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
Hey: On Thu, Dec 25, 2014 at 12:38 PM, Pierre Joye pierre@gmail.com wrote: On Thu, Dec 25, 2014 at 3:06 PM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 23:53, Levi Morrison le...@php.net wrote: On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter johan...@schlueters.de wrote: On

[PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Xinchen Hui
Hey: We use SUCCESS/FAILURE as return value in some APIs, but use 0/1(false/true) in others. I'd like to remove SUCCESS/FAILURE at all, use 0/1 instead.. what do you think? thanks -- Xinchen Hui @Laruence http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Stanislav Malyshev
Hi! Hey: We use SUCCESS/FAILURE as return value in some APIs, but use 0/1(false/true) in others. I'd like to remove SUCCESS/FAILURE at all, use 0/1 instead.. what do you think? I think it would make reading code harder. Why do it - is there any benefit in it? SUCCESS/FAILURE

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Xinchen Hui
Hey On Dec 24, 2014, at 12:49 PM, Stanislav Malyshev smalys...@gmail.com wrote: Hi! Hey: We use SUCCESS/FAILURE as return value in some APIs, but use 0/1(false/true) in others. I'd like to remove SUCCESS/FAILURE at all, use 0/1 instead.. what do you think? I think it

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Stanislav Malyshev
Hi! I think if(func()) is better, more readeable than if(func() == success) Not really, especially given the fact that for major part of libc if(func()) means checking for error, not for success, as success value is 0. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Xinchen Hui
On Dec 24, 2014, at 12:55 PM, Xinchen Hui larue...@gmail.com wrote: Hey On Dec 24, 2014, at 12:49 PM, Stanislav Malyshev smalys...@gmail.com wrote: Hi! Hey: We use SUCCESS/FAILURE as return value in some APIs, but use 0/1(false/true) in others. I'd like to remove

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Andrea Faulds
On 24 Dec 2014, at 03:25, Xinchen Hui larue...@php.net wrote: Hey: We use SUCCESS/FAILURE as return value in some APIs, but use 0/1(false/true) in others. I'd like to remove SUCCESS/FAILURE at all, use 0/1 instead.. what do you think? thanks Hi, Honestly, I don’t think

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Xinchen Hui
Hey: thanks, that is the first thought of mine too. On Wed, Dec 24, 2014 at 1:06 PM, Andrea Faulds a...@ajf.me wrote: On 24 Dec 2014, at 03:25, Xinchen Hui larue...@php.net wrote: Hey: We use SUCCESS/FAILURE as return value in some APIs, but use 0/1(false/true) in others. I'd

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Stanislav Malyshev
Hi! But: return 0 and return FAILURE... which is simpler? It's equally simple to write, but FAILURE of course is way simpler to understand when read. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Pierre Joye
On Dec 24, 2014 2:38 PM, Stanislav Malyshev smalys...@gmail.com wrote: Hi! But: return 0 and return FAILURE... which is simpler? It's equally simple to write, but FAILURE of course is way simpler to understand when read. I totally agree. I do not care much about the value of failure or