« first day (2057 days earlier)      last day (2907 days later) » 

11:05 PM
@Levi so, what shall I do about Reflection in union types RFC now?
or do nothing and postpone better design of Reflection for later?
 
I noticed that functions that declare ?Type as the return have to explicitly use return null. Simply return generates an error. I assume that was intentional?
 
wat… o_O
 
^ That's what I thought.
function baz(): ?int {
    return;
}
Return value of baz() must be of the type integer, none returned
 
@Trowski I don't know about intentional, but it's consistent with behavior of void
Though the error message isn't great
 
@NikiC With void I can use return; yet, correct?
 
11:17 PM
@Trowski with void you can use only return;. With nullable you can use only return null
return; in a nullable function is bad style
 
@Trowski well, sort of.
 
And void went the way of enforcing that this bad style does not occur
 
@NikiC really?
 
I think we permit function baz(): ?int {}
which we probably shouldn't
 
I'm honestly doing it all the time @NikiC …
:x
 
Wes
11:19 PM
... me too
 
@Andrea Yeah...
 
Don't make it worse now :x
 
if we have void we should probably be consistent
 
@bwoebi It's like in C you have a int* function and put a return; in it instead of return null
The compiler will scream at you
Because return; is really a "return void"
 
in other languages, yes
 
11:21 PM
lol
 
in PHP it always has been return the default value… (null)
 
I'm not interested in another void semantics discussion
 
Me neither.
Thus let's just agree with me.
 
And this is the exact same question
And we already made a descision on this point
Lets stick to that decision...
 
hrmm
 
11:22 PM
Though it sucks that the nullables RFC doesn't specify how it should work
 
heck, couldn't we validate it at compile-time
validate that there is a return statement
the opposite of what we do for void
 
@Andrea not without false positives
 
@NikiC oh?
oh right control flow
okay, we just need to make sure the implicit return is never accepted in a (non-void) return typed function
 
@Andrea yeah basically you'd end up with adding returns to "please the compiler" :)
Which is fine really, but probably not a great fit for php
 
@NikiC like people do in C :'(
 
11:27 PM
More like Java
C usually doesn't care...
 
@NikiC -Wall ;)
 
@Andrea heh
assert + __builtin_unreachable to the rescue
 
@Andrea meh :-P
 
I prefer the explicitness of return null, but I think a lot of PHP coders would expect just return to work in a nullable return-typed function.
 
they chose this pain when they added the return type :p
 
11:31 PM
That's true. Just expect some bug reports then :-D
 
@Andrea so, you are actively encouraging to not use return types?
 
@bwoebi heh
 
so who's good with building pcs?
 
@Andrea It's the truth…
 
I don't think anyone is not going to add the type just because they have to then use return null instead of just return.
 
11:38 PM
@Trowski dunno… I don't know yet if I'll be able to be bothered enough to still add them
 
When is the deadline for 7.1 features?
 
@Andrea I disagree
It's intentionally not restricted.
Remember the semantics of null.
 
I am aware of them
 
11:57 PM
51 mins ago, by bwoebi
@Levi so, what shall I do about Reflection in union types RFC now?
51 mins ago, by bwoebi
or do nothing and postpone better design of Reflection for later?
^ @LeviMorrison …
 
Oh, sorry.
Missed those
 

« first day (2057 days earlier)      last day (2907 days later) »