Re: [PHP-DEV] [RFC] Nullable Types

2016-04-25 Thread Jesse Schalken
On Sun, Apr 24, 2016 at 2:58 AM, Levi Morrison wrote: > On Sat, Apr 23, 2016 at 10:40 AM, Quim Calpe wrote: > > Option is no better than a union type with null[1]. If a language > requires an option to be unwrapped then it can do the same with some > type or null.

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-24 Thread Tom Worster
Hi Thomas, Sorry for the delay. I was traveling last week. By convention `return;` in PHP is an early return for a function that returns nothing at all. I think it can be confusing when reading a function to look at a `return;` line and have to remember to look elsewhere to discover what that

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-23 Thread Quim Calpe
On Sat, Apr 23, 2016 at 6:58 PM, Levi Morrison wrote: > On Sat, Apr 23, 2016 at 10:40 AM, Quim Calpe wrote: > > Hi Richard, > > > > On Sat, Apr 23, 2016 at 2:30 PM, Fleshgrinder > wrote: > > > >> On 4/22/2016 11:42 AM, Quim Calpe wrote: >

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-23 Thread Levi Morrison
On Sat, Apr 23, 2016 at 10:40 AM, Quim Calpe wrote: > Hi Richard, > > On Sat, Apr 23, 2016 at 2:30 PM, Fleshgrinder wrote: > >> On 4/22/2016 11:42 AM, Quim Calpe wrote: >> > IMHO, the point of Optional types is the intention, if you get an >> > Option from

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-23 Thread Quim Calpe
Hi Richard, On Sat, Apr 23, 2016 at 2:30 PM, Fleshgrinder wrote: > On 4/22/2016 11:42 AM, Quim Calpe wrote: > > IMHO, the point of Optional types is the intention, if you get an > > Option from a method, you have to deal with a None branch. Of course > > you can just

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-23 Thread Fleshgrinder
On 4/22/2016 11:42 AM, Quim Calpe wrote: > IMHO, the point of Optional types is the intention, if you get an > Option from a method, you have to deal with a None branch. Of course > you can just unwrap and go on, but it's a developer decision to do that, > not an oversight as using a Foo|null (or

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-22 Thread Quim Calpe
On Thu, Apr 21, 2016 at 9:52 PM, Fleshgrinder wrote: > On 4/21/2016 1:00 PM, Lin Yo-An wrote: > > I think this is not to make PHP like Java, and it totally makes sense - > > Nullable should be a type of a type instead of a state. In Haskell it's > > named Maybe or Option,

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Thomas Bley
> Note that the same /would/ be possible with union types if given precedence: > > function fn(): int|false {} false is currently not supported in the union_types rfc. Regards Thomas Fleshgrinder wrote on 21.04.2016 21:33: > On 4/21/2016 6:33 PM, Thomas Bley wrote: >> Hello Tom, >> >> with

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Fleshgrinder
On 4/21/2016 1:00 PM, Lin Yo-An wrote: > I think this is not to make PHP like Java, and it totally makes sense - > Nullable should be a type of a type instead of a state. In Haskell it's > named Maybe or Option, and It's better than NullPointerException. > > Here is a discussion from Haskell

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Fleshgrinder
On 4/21/2016 6:33 PM, Thomas Bley wrote: > Hello Tom, > > with default return value I mean to return a certain value if nothing else is > returned (similar to method parameters with a default value). > > example 1: > > declare(strict_types=0); > > function my_strpos(string $haystack, string

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Thomas Bley
Hello Tom, with default return value I mean to return a certain value if nothing else is returned (similar to method parameters with a default value). example 1: declare(strict_types=0); function my_strpos(string $haystack, string $needle): int = false { return 42; // return 42 return

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread fsb
omeone may like this, someone not. Thanks. Dmitry. From: guilhermebla...@gmail.com <guilhermebla...@gmail.com> Sent: Wednesday, April 20, 2016 18:05 To: Lin Yo-An Cc: Dmitry Stogov; Tom Worster; internals Subject: Re: [PHP-DEV] [RFC] Nullable Types I read the RFC and I want to hi

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread fsb
Hi Thomas, What is a default return declaration? Is this for branches within the function that do not lead to a return statement? Tom From: Thomas Bley Sent: ‎Wednesday‎, ‎April‎ ‎20‎, ‎2016 ‎12‎:‎53‎ ‎PM To: guilhermebla...@gmail.com, cornelius.h...@gmail.com, dmi...@zend.com Cc:

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Lin Yo-An
On Wed, Apr 20, 2016 at 11:05 PM, guilhermebla...@gmail.com < guilhermebla...@gmail.com> wrote: > > Dmitry is even involved in the discussion of having IS_UNDEF until > constructor ends, then enforcing type hinting at the end of constructor to > trigger potential invalid instance state. It created

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-20 Thread Levi Morrison
On Wed, Apr 20, 2016 at 11:55 AM, Jesse Schalken wrote: > I read the RFC and it all sounds good to me. I appreciate the care taken to > ensure method compatibility rules are correct, a smooth interop with =null, > and to consider impact on union types if added later (?

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-20 Thread Jesse Schalken
I read the RFC and it all sounds good to me. I appreciate the care taken to ensure method compatibility rules are correct, a smooth interop with =null, and to consider impact on union types if added later (? just becomes sugar). I'm not sure if it's been mentioned or not, but the position of the

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-20 Thread guilhermebla...@gmail.com
com> > *Sent:* Wednesday, April 20, 2016 18:05 > *To:* Lin Yo-An > *Cc:* Dmitry Stogov; Tom Worster; internals > *Subject:* Re: [PHP-DEV] [RFC] Nullable Types > > I read the RFC and I want to highlight why I'll vote -1 on it even before > it goes to voting. > > IM

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-20 Thread Thomas Bley
s, > someone not. > > > Thanks. Dmitry. > > > From: guilhermebla...@gmail.com <guilhermebla...@gmail.com> > Sent: Wednesday, April 20, 2016 18:05 > To: Lin Yo-An > Cc: Dmitry Stogov; Tom Worster; internals > Subject: Re: [PHP-DEV] [RFC] Nullable Types

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-20 Thread Dmitry Stogov
o may make sense. Someone may like this, someone not. Thanks. Dmitry. From: guilhermebla...@gmail.com <guilhermebla...@gmail.com> Sent: Wednesday, April 20, 2016 18:05 To: Lin Yo-An Cc: Dmitry Stogov; Tom Worster; internals Subject: Re: [PHP-DEV] [RFC] Nullab

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-20 Thread guilhermebla...@gmail.com
I read the RFC and I want to highlight why I'll vote -1 on it even before it goes to voting. IMHO, it looks backwards to what the language is progressing. The introduction of nullable type hint as a separate notation than a simple type hint makes it *very* hard to implement typed properties,

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-18 Thread Lin Yo-An
On Mon, Apr 18, 2016 at 4:59 PM, Dmitry Stogov wrote: > The grammar is taken from HHVM. > Using any other would make more mess. > I agree

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-18 Thread Dmitry Stogov
The grammar is taken from HHVM. Using any other would make more mess. Thanks. Dmitry. From: Tom Worster <f...@thefsb.org> Sent: Saturday, April 16, 2016 04:54 To: Dmitry Stogov; internals Subject: Re: [PHP-DEV] [RFC] Nullable Types On 4/15/16 1

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-16 Thread Björn Larsson
Den 2016-04-15 kl. 19:58, skrev Dmitry Stogov: A week ago, I actually wrote my own RFC https://wiki.php.net/rfc/nullable_return_types but didn't push it for discussion in favor of Levi's nullable_type RFC (they are almost the same). I'm sure, union types bring too many conceptual and

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-16 Thread Lester Caine
On 14/04/16 04:42, Levi Morrison wrote: > There are precedents in several languages for each position. Some > relevant issues to where the question mark goes are noted in the > RFC[3]. Another discussion reference ... http://www.firebirdsql.org/manual/nullguide.html

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-15 Thread Tom Worster
On 4/15/16 1:58 PM, Dmitry Stogov wrote: A week ago, I actually wrote my own RFC https://wiki.php.net/rfc/nullable_return_types You proposed the ?Something grammar. With ?: and ?? appearing in recent PHP and proposals for ??= if not ?:= and now this, I feel we're heading to regex hell :p

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-15 Thread Lester Caine
On 15/04/16 18:58, Dmitry Stogov wrote: > I'm sure, union types bring too many conceptual and implementation questions, > and I even don't speak abut intersections. The one problem I see with all of this is that it is reliant on every single variable being passed in when in early PHP5 days the

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-15 Thread Dmitry Stogov
intersections. Thanks. Dmitry. From: Tom Worster <f...@thefsb.org> Sent: Friday, April 15, 2016 20:17 To: Dmitry Stogov; internals Subject: Re: [PHP-DEV] [RFC] Nullable Types On 4/14/16 3:50 AM, Dmitry Stogov wrote: > The up to date imple

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-15 Thread Tom Worster
On 4/14/16 3:50 AM, Dmitry Stogov wrote: The up to date implementation for return-type-hints may be found at https://github.com/php/php-src/pull/1851/files Splendid! Thank you, Dmitry. I will refer to it in the nullable_returns RFC[1]. Tom [1] https://wiki.php.net/rfc/nullable_returns --

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-14 Thread Fleshgrinder
On 4/14/2016 5:42 AM, Levi Morrison wrote: > As alluded to in an earlier email today[1] I am now moving the > Nullable Types RFC[2] to the discussion phase. In a nutshell this RFC > proposes syntax for declaring a type to alternatively be null. > > There is a decision that needs to be made: does

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-14 Thread Matt Prelude
On 14/04/16 10:59, Davey Shafik wrote: On Thu, Apr 14, 2016 at 2:00 AM, Derick Rethans wrote: On Wed, 13 Apr 2016, Levi Morrison wrote: As alluded to in an earlier email today[1] I am now moving the Nullable Types RFC[2] to the discussion phase. In a nutshell this RFC

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-14 Thread Davey Shafik
On Thu, Apr 14, 2016 at 2:00 AM, Derick Rethans wrote: > On Wed, 13 Apr 2016, Levi Morrison wrote: > > > As alluded to in an earlier email today[1] I am now moving the > > Nullable Types RFC[2] to the discussion phase. In a nutshell this RFC > > proposes syntax for declaring a

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-14 Thread Derick Rethans
On Wed, 13 Apr 2016, Levi Morrison wrote: > As alluded to in an earlier email today[1] I am now moving the > Nullable Types RFC[2] to the discussion phase. In a nutshell this RFC > proposes syntax for declaring a type to alternatively be null. > > There is a decision that needs to be made: does

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-14 Thread Dmitry Stogov
On 04/14/2016 06:42 AM, Levi Morrison wrote: As alluded to in an earlier email today[1] I am now moving the Nullable Types RFC[2] to the discussion phase. In a nutshell this RFC proposes syntax for declaring a type to alternatively be null. +1 The up to date implementation for