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
> 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
>
> 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
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
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
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?)
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
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`.
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
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
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
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
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
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
> >>
> >>
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
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
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
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
37 matches
Mail list logo