« first day (1428 days earlier)      last day (3538 days later) » 

11:00 PM
It wasn't an option when I first introduced nullable types because I was targeting a PHP 5 release.
 
@AndreaFaulds not happy about that. Then I'd prefer more something like type | null and allow multiple typehints generally.
The more I think about it, the stronger I feel about voting no on a nullable types RFC.
 
Then we need multiple type hints for parameters too
 
@LeviMorrison disagree.
 
Fine, disagree. I highly doubt such an RFC will pass.
But, feel free to prove me wrong.
 
Multiple types makes casting types impossible
 
11:02 PM
@LeviMorrison Actually, I prefer nothing at all over nullable types.
@AndreaFaulds type casting null is bad too.
 
Can we have multiple inheritance too?
 
Nullable types makes sense. It's very common to want a parameter to be null, and functions need to be able to return null sometimes.
@bwoebi No, I mean, you couldn't do int | string
@Leigh Get out.
 
@AndreaFaulds what would be the return type if you e.g. return key($array); ?
 
@AndreaFaulds (that's my opinion of scotland btw) ;)
 
Sorry for getting heated, guys. I still stand by what I have said, just not how I said it. I have had a very stressful week; I apologize.
 
11:04 PM
@bwoebi mixed
 
@AndreaFaulds and how's that better than int | string?
 
It's not.
 
@AndreaFaulds except less descriptive?
 
The point is you don't have to have type hints to describe multiple types.
If that's what you want, use PHP's long-established dynamic nature.
 
Okay. Then please use also the dynamic nature of PHP if you want to return null.
 
11:06 PM
Generally I agree with that.
 
@bwoebi Why can't I type hint something being nullable?
 
doesn't returning null only make sense for things that would ordinarily return an object?
 
@Leigh It sometimes makes sense as an error value in other places
 
like, things that would return an array return an empty array, things that return a string return an empty string, things that return an object return null
things that return an error generate an exception :p
 
(param?param)
 
11:08 PM
@LeviMorrison just tell me, why do we need return typehints at all? IMO, it's to not have a need for docblocks etc. And that'd be best done if we allow everything. Not just objects and null.
 
@bwoebi The biggest case is during inheritance you want to ensure that inheritors cannot change the type on you.
Or when implementing interfaces.
There are some other, minor benefits that come with it that alone would not be worth proposing.
And I believe parameter types are more useful than return types.
 
11:28 PM
@bwoebi The people frequenting this room could live well without nullable return types. The problem is that among people outside this room it is a widespread pattern.
 
huh
so you meant that vote thing like right away?
 
Yeah.
 
... yeah I didn't realize that's what you meant either.
 
Given how much the RFC changed in the meantime, I feel like it might be worthwhile to have some more discussion
 
11:32 PM
Has it even been mentioned on-list recently as being discussed?
 
I posted on list for each change...
@LeviMorrison It hasn't been discussed for about 2 months I think, except for the odd random email from outside
 
Right. I'd have recommended posting an 'intent to vote' type email.
Be aware others will probably complain.
 
That probably would've been wiser, yeah.
 
Also, can you please extend the vote? I am going to be in Switzerland :D
 
Know what, I'll cancel it for now. That was a bit rash.
 
11:34 PM
@LeviMorrison oh, definitely. yes.
@LeviMorrison That, actually could also be done by a manual check…?
 
@bwoebi I don't understand. Could you say it differently?
 
Cancelled vote
It was in voting for all of about four minutes :p
 
@AndreaFaulds "Vote was closed with 100% of the votes in favor" :)
 
@NikiC I was going to say that :D
 
@AndreaFaulds well. a) Do we need float type at all? Is numeric not enough? b) please, please make bool typehints accept int(0) and int(1) too. c) What about passing an object with a __toString() method to a string typehint? d) integer hints would be better if we had bigints.
 
11:40 PM
See, this is one of my worst qualities. My decisiveness is binary
 
That are the remaining issues before I'd put it to vote.
 
Have any of you guys given any thought to deprecating PHP 4 constructors?
I came across them by accident again the other day. I'm not suggesting that we do deprecate them, it is a possibility I haven't given thought to and was wondering if anyone had.
 
@LeviMorrison I think it was discussed a bit in here a few days ago…
 
@bwoebi 1) Yes we do need float, if you want a float you shouldn't need to accept numeric and cast 2) I chose to make bools strict to avoid all the problems with what should be a bool and what shouldn't, and also because they don't freely cast losslessly back-and-forth with string/int/float, 3) __toString() object accepted for string, 4) Yeah, unfortunately we do not have bigints. (yet? :)
 
@AndreaFaulds what's the advantage of float in that case?
 
11:43 PM
@bwoebi I tried searching the logs; can't find it. Would appreciate a link if you can find one.
 
@AndreaFaulds Does having a float type have any practical advantage over numeric?
 
Probably not for most cases, but we still ought to have it for completeness
 
@AndreaFaulds actually, I don't care about anything, but I often pass a literal 0/1 for boolean types.
@AndreaFaulds show me one example. I can't think of any case.
 
I can't think of one. However, I still think it's good to have
If you have numeric, it implies that it works with ints
 
It's good to have something useless? nice.
 
11:46 PM
It's not useless
If you accept numeric, presumably you work with integers losslessly
Otherwise you'd be accepting float
there's a big difference between abs(numeric $n) and abs(float $n)
 
oh, the precision thing.
We just should use long doubles in PHP, then that wouldn't be an issue.
 
But then if we add bigints it's a problem again ;)
 
true. But when we add bigints, we should make all the functions accepting pure doubles accepting numeric.
Because too much loss of precision.
And when we introduce bigints, functions like ceil, floor and round should also return bigints.
 
@bwoebi No, that'd be silly, most make no sense with integers
@bwoebi floor and ceil are useless with integers
 
@AndreaFaulds they're sometimes passed through, just to have everything rounded.
 
11:55 PM
@AndreaFaulds indeed, should only take in real, also round
 
round up everything in an array: array_map('ceil', $array) … and what when some values are ints, others floats in the array?
yeah… what'll happen? all the bigints will loose their precision.
 

« first day (1428 days earlier)      last day (3538 days later) »