Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Matthew Brown
On Sat, 3 Apr 2021 at 22:29, David Rodrigues wrote: > It is very likely that the proposal will be accepted (it is already 33/10), > I'm definitely not counting my chickens. > Is there any chance of discussing terms, even if the "never" indication is > winning at the moment? Or did I miss this

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread David Rodrigues
Just to spice up the discussion a bit, I will try to give my opinion on this RFC... It is very likely that the proposal will be accepted (it is already 33/10), but I still find the terms "noreturn" or "never" unclear. "noreturn" are two words together, and I am not particularly a fan of this type

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Matthew Brown
On Sat, 3 Apr 2021 at 12:30, Benjamin Eberlei wrote: > > But adding a new keyword "noreturn" would not be necessary, it could just > be an Attribute as i said in my first e-mail explaining my no-vote: > > #[NoReturn] // sets a function flag modifying the void behavior > public function foo():

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Andreas Leathley
On 03.04.21 21:26, Peter Bowyer wrote: This and Levi's email make compelling arguments and I would like to see this adopted. I have changed my vote to "No". Wasn't Levi arguing for the RFC? Introducing "never" as a bottom type is what Levi was strongly arguing for, and that is what the RFC

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Peter Bowyer
On Sat, 3 Apr 2021 at 17:30, Benjamin Eberlei wrote: > The problem is that "void" is already not perfect, since the callside > doesn't care about "return null" with no return type vs "return" + void > return type. > > If we had "nothing" and "null" instead of "void", and we'd say like PHP >

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Andreas Leathley
On 03.04.21 18:30, Benjamin Eberlei wrote: if (is_string($value) && is_int($value)) { // inside here $value is_type == "never" } The naming "never" here makes no sense, because from a theoretical perspective reasoning about the type of $value it is nothing and only the block of code is

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Benjamin Eberlei
On Sat, Apr 3, 2021 at 5:30 PM Benjamin Eberlei wrote: > > > On Fri, Apr 2, 2021 at 3:14 AM Aaron Piotrowski wrote: > >> >> > On Apr 1, 2021, at 2:03 PM, Levi Morrison via internals < >> internals@lists.php.net> wrote: >> > >> > I do not care which name is chosen, but if we are going to have

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Rowan Tommins
On 03/04/2021 16:30, Benjamin Eberlei wrote: But I again get to the point of the problem with this RFC due to naming. "never" is actually combining "nothing" type with "noreturn" flag, so for me the most consistent way would have been "public noreturn function foo(): nothing" I'm not sure how

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread Benjamin Eberlei
On Fri, Apr 2, 2021 at 3:14 AM Aaron Piotrowski wrote: > > > On Apr 1, 2021, at 2:03 PM, Levi Morrison via internals < > internals@lists.php.net> wrote: > > > > I do not care which name is chosen, but if we are going to have this > > sort of thing in the language, it ought to be a bottom type,

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-02 Thread Kamil Tekiela
I am still not comfortable with the error message "Nothing was expected to be returned" which is very confusing and I would change it to "was expected to throw or exit" or "was expected to never return". I went with "never" because it just reads better: "Function abc returns never" instead of

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Aaron Piotrowski
> On Apr 1, 2021, at 2:03 PM, Levi Morrison via internals > wrote: > > I do not care which name is chosen, but if we are going to have this > sort of thing in the language, it ought to be a bottom type, not an > attribute. > You make an excellent point Levi. I initially chose `noreturn`

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Levi Morrison via internals
On Thu, Apr 1, 2021 at 6:59 AM Matthew Brown wrote: > > On Thu, 1 Apr 2021 at 04:56, Benjamin Eberlei wrote: > > > This RFC is using the declaration of the return type, to specify that it > > never returns. As such noreturn or never is a keyword a long the lines of > > public or final, but it is

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Ondřej Mirtes
On 1. 4. 2021 19:24:35, Bruce Weirdan wrote: > Since `throw` is an expression (since PHP 8.0, > https://wiki.php.net/rfc/throw_expression), it must have a type for its > result, > as any expression has a type. And it's result is exactly `noreturn` (or > `never`, as this option seems to be

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Bruce Weirdan
On Thu, Apr 1, 2021 at 6:07 PM Benjamin Eberlei wrote: > > ```php > if (!isset($user)) { >throw new NotFoundException(); > } > ``` > Since `throw` is an expression (since PHP 8.0, https://wiki.php.net/rfc/throw_expression), it must have a type for its result, as any expression has a type.

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Andreas Leathley
On 01.04.21 17:07, Benjamin Eberlei wrote: I don't know, you are arguing that you forgot a return, but you also did not forget to add a never return type. You could easily fix this by inlining the exception instead. ```php if (!isset($user)) { throw new NotFoundException(); } ``` Even when

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Benjamin Eberlei
On Thu, Apr 1, 2021 at 3:56 PM Andreas Leathley wrote: > On 01.04.21 10:56, Benjamin Eberlei wrote: > > This RFC is using the declaration of the return type, to specify that it > > never returns. As such noreturn or never is a keyword a long the lines of > > public or final, but it is not a

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Andreas Leathley
On 01.04.21 10:56, Benjamin Eberlei wrote: This RFC is using the declaration of the return type, to specify that it never returns. As such noreturn or never is a keyword a long the lines of public or final, but it is not a return type. I don't think the argument for potential optimizations in

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Matthew Brown
On Thu, 1 Apr 2021 at 04:56, Benjamin Eberlei wrote: > This RFC is using the declaration of the return type, to specify that it > never returns. As such noreturn or never is a keyword a long the lines of > public or final, but it is not a return type. > > I don't think the argument for potential

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Sebastian Bergmann
Am 01.04.2021 um 10:56 schrieb Benjamin Eberlei: I voted no, because i think this should at the maximum be an attribute. This RFC is using the declaration of the return type, to specify that it never returns. As such noreturn or never is a keyword a long the lines of public or final, but it is

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Benjamin Eberlei
On Tue, Mar 30, 2021 at 5:07 PM Matthew Brown wrote: > Hey everyone! > > The vote for adding noreturn is now open: > > https://wiki.php.net/rfc/noreturn_type > > Voting will run through April 13th > > Best wishes, > > Matt and Ondrej > I voted no, because i think this should at the maximum be

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-31 Thread Matthew Brown
On Wed, 31 Mar 2021 at 09:30, Theodore Brown wrote: > On Tue, Mar 30, 2021 at 5:24 PM Matthew Brown > wrote: > > > On Tue, 30 Mar 2021 at 12:55, Theodore Brown > wrote: > > > > > On Tue, Mar 30, 2021 at 10:06 AM Matthew Brown < > matthewmatt...@gmail.com> wrote: > > > > > > > Hey everyone! > >

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-31 Thread Theodore Brown
On Tue, Mar 30, 2021 at 5:24 PM Matthew Brown wrote: > On Tue, 30 Mar 2021 at 12:55, Theodore Brown wrote: > > > On Tue, Mar 30, 2021 at 10:06 AM Matthew Brown > > wrote: > > > > > Hey everyone! > > > > > > The vote for adding noreturn is now open: > > > > > >

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-31 Thread Andreas Hennings
On Wed, 31 Mar 2021 at 14:41, Ilija Tovilo wrote: > > Hi internals > > On Wed, Mar 31, 2021 at 2:14 PM Andreas Hennings wrote: > > > > Also check my comment in the other thread: > > If in the future we want a "bottom type" that also works for parameters > > (generics or abstract methods), should

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-31 Thread Ilija Tovilo
Hi internals On Wed, Mar 31, 2021 at 2:14 PM Andreas Hennings wrote: > > Also check my comment in the other thread: > If in the future we want a "bottom type" that also works for parameters > (generics or abstract methods), should we create a new keyword, or should > we attempt to find a keyword

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-31 Thread Andreas Hennings
Also check my comment in the other thread: If in the future we want a "bottom type" that also works for parameters (generics or abstract methods), should we create a new keyword, or should we attempt to find a keyword now that works for all cases? Neither "never" nor "noreturn" seems suitable for

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-30 Thread Peter Stalman
Aw, my `terminus` suggestion didn't make it. ☹️ Thanks, Peter

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-30 Thread Matthew Brown
On Tue, 30 Mar 2021 at 12:55, Theodore Brown wrote: > On Tue, Mar 30, 2021 at 10:06 AM Matthew Brown > wrote: > > > Hey everyone! > > > > The vote for adding noreturn is now open: > > > > https://wiki.php.net/rfc/noreturn_type > > > > Voting will run through April 13th > > Hi Matt and Ondrej, >

Re: [PHP-DEV] [VOTE] noreturn type

2021-03-30 Thread Theodore Brown
On Tue, Mar 30, 2021 at 10:06 AM Matthew Brown wrote: > Hey everyone! > > The vote for adding noreturn is now open: > > https://wiki.php.net/rfc/noreturn_type > > Voting will run through April 13th Hi Matt and Ondrej, Thanks for your work on this RFC. I voted for `never` as the type name

[PHP-DEV] [VOTE] noreturn type

2021-03-30 Thread Matthew Brown
Hey everyone! The vote for adding noreturn is now open: https://wiki.php.net/rfc/noreturn_type Voting will run through April 13th Best wishes, Matt and Ondrej