Re: [PHP-DEV] About SUCCESS/FAILURE

2015-01-05 Thread Julien Pauli
On Sat, Dec 27, 2014 at 4:45 AM, Pierre Joye wrote: > On Dec 26, 2014 7:42 PM, "Xinchen Hui" wrote: > > > > Hey: > > > > On Fri, Dec 26, 2014 at 7:54 PM, Andrea Faulds wrote: > > > > > >> On 26 Dec 2014, at 05:57, Levi Morrison wrote: > > >> > > >>> On Thu, Dec 25, 2014 at 2:33 PM, Michael Wal

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-26 Thread Pierre Joye
On Dec 26, 2014 7:42 PM, "Xinchen Hui" wrote: > > Hey: > > On Fri, Dec 26, 2014 at 7:54 PM, Andrea Faulds wrote: > > > >> On 26 Dec 2014, at 05:57, Levi Morrison wrote: > >> > >>> On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner wrote: > >>> There's already ZEND_RESULT_CODE, or did I miss anyth

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-26 Thread Levi Morrison
On Fri, Dec 26, 2014 at 5:42 AM, Xinchen Hui wrote: > Hey: > > On Fri, Dec 26, 2014 at 7:54 PM, Andrea Faulds wrote: >> >>> On 26 Dec 2014, at 05:57, Levi Morrison wrote: >>> On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner wrote: There's already ZEND_RESULT_CODE, or did I miss anythi

Re: [PHP-DEV] About SUCCESS/FAILURE

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

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-26 Thread Andrea Faulds
> On 26 Dec 2014, at 05:57, Levi Morrison wrote: > >> On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner 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 b

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-25 Thread Xinchen Hui
Hey: On Fri, Dec 26, 2014 at 5:33 AM, Michael Wallner 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 ZEND_API's return

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-25 Thread Levi Morrison
On Thu, Dec 25, 2014 at 2:33 PM, Michael Wallner 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. Theoretically renam

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-25 Thread Pierre Joye
On Fri, Dec 26, 2014 at 8:33 AM, Michael Wallner 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 is to begin

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" wrote: > Hey: > > On Thu, Dec 25, 2014 at 12:38 PM, Pierre Joye > wrote: > > On Thu, Dec 25, 2014 at 3:06 PM, Andrea Faulds wrote: > >> > >>> On 24 Dec 2014, at 23:53, Levi Morrison wrote: > >>> > >>

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
Hey: On Thu, Dec 25, 2014 at 12:38 PM, Pierre Joye wrote: > On Thu, Dec 25, 2014 at 3:06 PM, Andrea Faulds wrote: >> >>> On 24 Dec 2014, at 23:53, Levi Morrison wrote: >>> >>> On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter >>> wrote: On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wr

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Thu, Dec 25, 2014 at 3:34 PM, Xinchen Hui wrote: > Hey: > > On Thu, Dec 25, 2014 at 12:06 PM, Andrea Faulds wrote: >> >>> On 24 Dec 2014, at 23:53, Levi Morrison wrote: >>> >>> On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter >>> wrote: On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Thu, Dec 25, 2014 at 3:06 PM, Andrea Faulds wrote: > >> On 24 Dec 2014, at 23:53, Levi Morrison wrote: >> >> On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter >> wrote: >>> On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wrote: >>> I'm asking for specific things. The reason is that som

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
Hey: On Thu, Dec 25, 2014 at 12:06 PM, Andrea Faulds wrote: > >> On 24 Dec 2014, at 23:53, Levi Morrison wrote: >> >> On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter >> wrote: >>> On Wed, 2014-12-24 at 11:13 -0700, Levi Morrison wrote: >>> I'm asking for specific things. The reason is t

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Andrea Faulds
> On 24 Dec 2014, at 23:53, Levi Morrison wrote: > > On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter > 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

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Levi Morrison
On Wed, Dec 24, 2014 at 4:27 PM, Johannes Schlüter 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 to care about.

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 Andrea Faulds
> On 24 Dec 2014, at 18:13, Levi Morrison wrote: > > On Wed, Dec 24, 2014 at 10:34 AM, Andrea Faulds wrote: >> >>> On 24 Dec 2014, at 17:22, Levi Morrison wrote: >>> >>> Hmm. This thread doesn't seem to mention it, but why must failure be >>> negative? I understand the non-zero part but not

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Dec 25, 2014 1:13 AM, "Levi Morrison" wrote: > > On Wed, Dec 24, 2014 at 10:34 AM, Andrea Faulds wrote: > > > >> On 24 Dec 2014, at 17:22, Levi Morrison wrote: > >> > >> Hmm. This thread doesn't seem to mention it, but why must failure be > >> negative? I understand the non-zero part but not

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Levi Morrison
On Wed, Dec 24, 2014 at 10:34 AM, Andrea Faulds wrote: > >> On 24 Dec 2014, at 17:22, Levi Morrison 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

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Andrea Faulds
> On 24 Dec 2014, at 17:22, Levi Morrison 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 other reas

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 Pierre Joye
On Dec 24, 2014 8:41 PM, "Johannes Schlüter" 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 > http://lxr.php.net/xref/PHP_TRUNK/ext/mysqln

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 sho

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Pierre Joye
On Wed, Dec 24, 2014 at 7:53 PM, Xinchen Hui wrote: > On Wed, Dec 24, 2014 at 3:57 PM, Pierre Joye wrote: >> >> On Dec 24, 2014 2:38 PM, "Stanislav Malyshev" wrote: >>> >>> Hi! >>> >>> > But: return 0 and return FAILURE... which is simpler? >>> >>> It's equally simple to write, but FAILURE of c

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
On Wed, Dec 24, 2014 at 3:57 PM, Pierre Joye wrote: > > On Dec 24, 2014 2:38 PM, "Stanislav Malyshev" 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

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-24 Thread Xinchen Hui
Hey: On Wed, Dec 24, 2014 at 3:38 PM, Stanislav Malyshev 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, true === 1 is

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Pierre Joye
On Dec 24, 2014 2:38 PM, "Stanislav Malyshev" 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 success bu

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: http://www.php.net/unsub

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 wrote: > >> On 24 Dec 2014, at 03:25, Xinchen Hui 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

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Andrea Faulds
> On 24 Dec 2014, at 03:25, Xinchen Hui 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 SUCCES

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Xinchen Hui
> On Dec 24, 2014, at 12:55 PM, Xinchen Hui wrote: > > Hey > > >> On Dec 24, 2014, at 12:49 PM, Stanislav Malyshev 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/FAILU

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 Deve

Re: [PHP-DEV] About SUCCESS/FAILURE

2014-12-23 Thread Xinchen Hui
Hey > On Dec 24, 2014, at 12:49 PM, Stanislav Malyshev 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! > 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/

[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