Re: Re: [RFC][VOTE] Nullable Types

From: Date: Thu, 12 May 2016 19:47:44 +0000
Subject: Re: Re: [RFC][VOTE] Nullable Types
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-93292@lists.php.net to get a copy of this message
On 05/12/2016 01:50 PM, Lester Caine wrote: > On 12/05/16 12:39, Michael Wallner wrote: >> On 12/05/16 13:36, Lester Caine wrote: >>>> On 12/05/16 11:21, Davey Shafik wrote: >>>>>> E.g. the behavior of passing executing with a null value for the >>>>>> argument is something you should be consciously making a decision on, >>>>>> and passing in null explicitly. >>>> I was actually getting the logic wrong... the problem with this proposal >>>> is that I HAVE to add the '?' for many of my libraries to continue to >>>> work simply because they do handle the null case. So what was a working >>>> system is broken by this change. >>>> >> So you already have function foo(Foo $foo = null)? >> No need to change anything. > To be honest I don't know ... *I* would not necessarily add '= null' > because that is the default case anyway ... I'm not sure fromthis > 'little change' just what the full knock on effect is to code that goes > back 15 years? you don't need to add '= null' or '?' anywhere. function that already accepts null arguments (either because it's untyped or because there is '= null') will continue to accept without any changes adding '?' will make the function more permissive. not adding it will not make any existing function more restrictive > -- Mathieu Rochette

« previous php.internals (#93292) next »