Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-19 Thread Derick Rethans
On Thu, 15 Oct 2015, Rowan Collins wrote: > Korvin Szanto wrote on 14/10/2015 23:55: > > If I capture the result of a "void" method and check if my result variable > > with isset(), I'll get false. This sounds like it's void of value to me. > > But why "invent" (as far as PHP is concerned) this

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-19 Thread Bob Weinand
> Am 19.10.2015 um 11:46 schrieb Derick Rethans : > > On Thu, 15 Oct 2015, Rowan Collins wrote: > >> Korvin Szanto wrote on 14/10/2015 23:55: >>> If I capture the result of a "void" method and check if my result variable >>> with isset(), I'll get false. This sounds like it's

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-16 Thread Lester Caine
On 16/10/15 01:45, Andrea Faulds wrote: > But why should we change the documentation anyway? We've used void for a > very long time, at least 17 years[0]. We don't just use it in the PHP > manual, it's also used in docblocks and the PHP source code's function > prototypes. It's the

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Rowan Collins
Andrea Faulds wrote on 14/10/2015 22:52: Good evening, I'm reviving my Void Return Type RFC, this time for PHP 7.1: https://wiki.php.net/rfc/void_return_type Please read it and tell me your thoughts! My feeling is that it is odd to have both of these be true at once: - void functions can

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Chris Riley
On 14 October 2015 at 22:52, Andrea Faulds wrote: > Good evening, > > I'm reviving my Void Return Type RFC, this time for PHP 7.1: > > https://wiki.php.net/rfc/void_return_type > > Please read it and tell me your thoughts! > > Thanks. > > P.S. As it so (fatefully?) happens, I

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Björn Larsson
Den 2015-10-14 kl. 23:52, skrev Andrea Faulds: Good evening, I'm reviving my Void Return Type RFC, this time for PHP 7.1: https://wiki.php.net/rfc/void_return_type Please read it and tell me your thoughts! Thanks. P.S. As it so (fatefully?) happens, I originally introduced this on 14th

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Rowan Collins
Korvin Szanto wrote on 14/10/2015 23:55: If I capture the result of a "void" method and check if my result variable with isset(), I'll get false. This sounds like it's void of value to me. But why "invent" (as far as PHP is concerned) this new keyword of "void" to mean exactly the same thing

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Rowan Collins
Andrea Faulds wrote on 15/10/2015 16:32: Hmm, this is an interesting case you've pointed out. Being able to do `return some_other_void_function();` is something I've desired in other languages. But what if that void function you're calling later adds a return value? Now the calling function

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hi Rowan, Rowan Collins wrote: I can see the point in denying the right to say "return some_function_expected_to_return_null();" But in a sense this is no different from declaring that a function returns int, and then writing "return some_function_expected_to_return_int();" If a void function

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Rowan Collins
Andrea Faulds wrote on 15/10/2015 16:32: Hi Rowan, Rowan Collins wrote: But why "invent" (as far as PHP is concerned) this new keyword of "void" to mean exactly the same thing "null" already means - absence of a definite value? They don't mean exactly the same thing. null is a value to

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hi Rowan, Rowan Collins wrote: But why "invent" (as far as PHP is concerned) this new keyword of "void" to mean exactly the same thing "null" already means - absence of a definite value? They don't mean exactly the same thing. null is a value to represent a lack of a value. But there's also

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Pedro Cordeiro
I've been thinking about what PHP should do when accessing the return value of a `void` function, and so far, I think the consistent thing should be to get NULL, while throwing an E_NOTICE. $a = $b; //$b wasn't initiated. This does the same thing. I tried accessing what was supposed to be

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hey Chris, Chris Riley wrote: Semantically, I don't believe that there is sufficient difference between "returns no value" and "returns a value which has been defined as having no value" for us to care about it. The main difference you get between return type of null and a return type of void

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hi Larry, Larry Garfield wrote: On 10/14/2015 06:30 PM, Andrea Faulds wrote: This would be strange. The manual doesn't say `null`, and I can't think of any language which uses `null` as the return type in this situation, even when they have the same implicit-null-return behaviour that PHP has

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Marc Bennewitz
On 10/15/2015 01:19 AM, Larry Garfield wrote: On 10/14/2015 06:00 PM, Andrea Faulds wrote: >> Both you and Stas have said this, but it's only true if we solely >> consider C-like languages. Other languages do different things. In >> the PHP manual, Hack, TypeScript, ActionScript, and most

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Rowan Collins
On 15 October 2015 20:33:04 BST, Andrea Faulds wrote: >> Obviously, type hints for internal functions are a bit weird anyway, >but >> there's no reason to assume that every function documented as void >would >> suddenly be annotated in the Engine as such and start returning >notices.

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Korvin Szanto
On Thu, Oct 15, 2015 at 4:21 PM Rowan Collins wrote: > On 15 October 2015 20:33:04 BST, Andrea Faulds wrote: > >> Obviously, type hints for internal functions are a bit weird anyway, > >but > >> there's no reason to assume that every function documented as

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hi Korvin, Korvin Szanto wrote: Could we change the documentation for existing functions to return null, and start using void properly moving forward? As I have stated several times now, we're not "misusing" void. PHP is not the only language to use the word in this manner. But why

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hey Chris, Chris Riley wrote: Semantically, I don't believe that there is sufficient difference between "returns no value" and "returns a value which has been defined as having no value" for us to care about it. The main difference you get between return type of null and a return type of void

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hi Pedro, Pedro Cordeiro wrote: I've been thinking about what PHP should do when accessing the return value of a `void` function, and so far, I think the consistent thing should be to get NULL, while throwing an E_NOTICE. We could do this, but I do wonder if it might cause a lot of E_NOTICEs

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Chris Riley
On 15 October 2015 at 16:32, Andrea Faulds wrote: > In a sense, what this RFC offers might be called a compromise. It enforces > the rules of `void` within the function, but at the end of the day the > caller still gets a null out of it since that's what PHP's always done. > > > If

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Pedro Cordeiro
> > this would make the "void" keyword feel more meaningful. I, too, had issues trying to understand what "void" was bringing to the table. IMHO, it should warn people thinking some specific function/method returns a value when it doesn't, not protect against some dev forgetting the function

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Rowan Collins
Pedro Cordeiro wrote on 15/10/2015 17:14: I've been thinking about what PHP should do when accessing the return value of a `void` function, and so far, I think the consistent thing should be to get NULL, while throwing an E_NOTICE. $a = $b; //$b wasn't initiated. This does the same thing. I

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Rowan Collins
Andrea Faulds wrote on 15/10/2015 17:34: Hi Pedro, Pedro Cordeiro wrote: I've been thinking about what PHP should do when accessing the return value of a `void` function, and so far, I think the consistent thing should be to get NULL, while throwing an E_NOTICE. We could do this, but I do

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Björn Larsson
Den 2015-10-15 kl. 09:04, skrev Björn Larsson: Den 2015-10-14 kl. 23:52, skrev Andrea Faulds: Good evening, I'm reviving my Void Return Type RFC, this time for PHP 7.1: https://wiki.php.net/rfc/void_return_type Please read it and tell me your thoughts! Thanks. P.S. As it so (fatefully?)

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-15 Thread Andrea Faulds
Hi Rowan, Rowan Collins wrote: Andrea Faulds wrote on 15/10/2015 17:34: Hi Pedro, Pedro Cordeiro wrote: I've been thinking about what PHP should do when accessing the return value of a `void` function, and so far, I think the consistent thing should be to get NULL, while throwing an

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Ryan Pallas
On Wed, Oct 14, 2015 at 4:46 PM, Levi Morrison wrote: > > > I agree that `void` doesn't make sense given that we document that > `return;` will return null[1]. If the union types RFC[2] passes it > makes sense to allow `Foo | null` which allows something of type `Foo` > or `null`.

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Stanislav Malyshev
Hi! > I'm reviving my Void Return Type RFC, this time for PHP 7.1: > > https://wiki.php.net/rfc/void_return_type > > Please read it and tell me your thoughts! I still see no point in this, as every PHP function actually returns something (at least null). So this type would not actually be

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Andrea Faulds
Hi Levi, Levi Morrison wrote: On Wed, Oct 14, 2015 at 4:00 PM, Stanislav Malyshev wrote: Hi! I'm reviving my Void Return Type RFC, this time for PHP 7.1: https://wiki.php.net/rfc/void_return_type Please read it and tell me your thoughts! I still see no point in

[PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Andrea Faulds
Good evening, I'm reviving my Void Return Type RFC, this time for PHP 7.1: https://wiki.php.net/rfc/void_return_type Please read it and tell me your thoughts! Thanks. P.S. As it so (fatefully?) happens, I originally introduced this on 14th February, and it's now 14th October, so it's been

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Andrea Faulds
Hi Stas, Stanislav Malyshev wrote: I still see no point in this, as every PHP function actually returns something (at least null). So this type would not actually be right and would not reflect what actually is happening. It wouldn't be incorrect. Not all languages with `void` prevent a

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Stanislav Malyshev
Hi! > And, heck, we use void in the PHP manual all the time. Yes, because PHP manual *is* the documentation :) Note that function descriptions in the manual, while they are similar to PHP syntax, aren't actually valid PHP, even after scalar typing introduction. Bizarrely enough, they don't even

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Korvin Szanto
On Wed, Oct 14, 2015 at 3:47 PM Levi Morrison wrote: > On Wed, Oct 14, 2015 at 4:00 PM, Stanislav Malyshev > wrote: > > Hi! > > > >> I'm reviving my Void Return Type RFC, this time for PHP 7.1: > >> > >> https://wiki.php.net/rfc/void_return_type > >> > >>

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Levi Morrison
On Wed, Oct 14, 2015 at 4:00 PM, Stanislav Malyshev wrote: > Hi! > >> I'm reviving my Void Return Type RFC, this time for PHP 7.1: >> >> https://wiki.php.net/rfc/void_return_type >> >> Please read it and tell me your thoughts! > > I still see no point in this, as every PHP

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Larry Garfield
On 10/14/2015 06:00 PM, Andrea Faulds wrote: Both you and Stas have said this, but it's only true if we solely consider C-like languages. Other languages do different things. In the PHP manual, Hack, TypeScript, ActionScript, and most likely other languages (these are just off the top of my

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Larry Garfield
On 10/14/2015 06:30 PM, Andrea Faulds wrote: Which I believe gives the following options: 1) Change the language behavior such that function foo() : void { ...} $a = foo(); Is a syntax error (because there really was nothing returned to assign), rather than resulting in $a having a value of

Re: [PHP-DEV] [RFC] Void Return Type (v0.2, reöpening)

2015-10-14 Thread Andrea Faulds
Hi Larry, Larry Garfield wrote: The tricky part here is that saying a function does not return is not something PHP currently does: https://3v4l.org/HtAuC No return implicitly returns NULL, which you can assign to a variable if, for some strange reason, you were so inclined. So this would be