« first day (1802 days earlier)      last day (3161 days later) » 

9:22 PM
@LeviMorrison Apart from not liking fn as a strict alias to function (I'd rather make fn specific to short declaration), I don't see anything immediately objectionable in that.
 
@Sara Andrea actually brought up the for keyword here… I feel like it makes sense: for these args, do x…
@Sara what do you think of it instead of a new fn (which some people obviously will oppose…)
 
Anonymous
@PeeHaa I'll look at it. Just been very busy lately.
 
@bwoebi as in: array_filter($arr, for $x do !empty($x)); ?
 
Anonymous
oh god no!!!
 
9:36 PM
or rather, with types: for(int $x) do $d > 0
 
@Sara for example or similar variations with an arrow instead of do, but yes.
 
@bwoebi My gut reaction is that it feels like it overloads "for" way too much, but I'll think about it more...
 
@Sara my reaction was more that it feels too pythonic… but I'm just collecting alternate ideas and looking whether people like it.
 
($x > 0) for $x ?
 
I really don't like for here.
 
9:38 PM
lol, no. Please not.
People complain about ~> … hence I'm searching for alternatives… but I'm having a hard time…
 
Go ruby: |$x| ($x > 0)
 
$x to 2 * $x
 
to isn't a reserved keyword current
*currently
Ideally we'd reserve no new keywords
 
My opinion is that it would reduce cognitive load to have the developer write things out the long way, so the whole shorthand syntax is a bad idea anyways... but that's just an untested hypothesis.
 
@Sara nice usage of bitwise ops. … it'd probably be a hard time to parse that.
 
9:41 PM
Ghedipunk: For longer closures, I agree. For for the really basic one-liners, I quite like short-lambda
 
@Sara Is it really that important? As we have the context sensitive lexer RFC, it's not a problem for methods anymore.
 
@bwoebi
@bwoebi That conflict is resolvable since bitwise or is a binary expression, you can't start an expr with '|'
@kelunik Perhaps not... after that's in. For now it's a problem. :p
 
@Sara It's implemented in 7.0.
 
@Sara yeah, right. the boolean or is actually its own token and not a double '|' '|'
 
@kelunik Is it already? well, nevermind then
 
9:43 PM
@Sara that's actually not that bad...
 
@Sara Yeah, I was just going over in my mind the similarities to the cognitive load of the ternary compare... Short and simple and part of an assignment is a great candidate for the ?:... but as someone who has to read other people's code, sooooo many people get it wrong.
 
@ircmaxell I'd want to double check ruby's exact syntax, but it's something close to that
 
@bwoebi to me, that looks like a list comprehension more than a lambda
 
@Sara Already with PhpStorm support. :)
 
@Sara [for $x in $arr do $x**2] <-- list comprehension
 
9:44 PM
@ircmaxell THAT use of for, I support
Though we already have foreach, so... meg
meh, as well
 
though we could do that as [$x**2 foreach $arr as $x]
 
o.o
 
@ircmaxell I don't feel very comfortable with adding right to left parsing in PHP…
 
@bwoebi what would you propose for list comprehensions?
 
@ircmaxell foreach $arr as $x do $x ** 2 would be much more natural…
 
9:47 PM
fair enough
 
but well, we have array_map… array_map($x ~> $x ** 2, $arr); is fine too?
so, not sure why we'd need list comprehensions
(at least from the moment on where we have a short closure syntax)
 
My vote, as someone who has to maintain other people's code, is that shorthand closures should be distinctive from normal, non-shorthand closures, just as ?: is distinct from normal conditionals.
Which for me means it should be outside of [a-zA-Z]*... Is the % token being used in some esoteric corner of PHP?
 
@Ghedipunk You mean the modulo operator :-P
 
@Trowski Yeah, I knew that. I'm blaming my earache.
 
It's an easy one to forget about, doesn't get used terribly often.
 
10:05 PM
~> is perfect for my use case... but makes things harder for others. It would be much easier for me to like something if I were xenophobic.
 
wow
> This probably may work for binding by value. Use by reference will still require explicit definition.
we're talking about binding by-value
wth is Dmitry arguing?
 
I was wondering that myself. It seems like Dmitry doesn't understand that by-reference isn't possible with short closures.
 
someone else reply, I'm done with that, it's a distraction
 
I have no idea either… not sure what he got wrong…
 
11:12 PM
so we still haven't decided to just copy Hack™
I'm thinking about abstaining from that voting for now because it will be impossible to be like hack later :< sorry @bwoebi
ps: it has nothing to do with the return type support thing.
 
@marcio no need to be sorry as long as you have a rationale ;-)
 
I'm only sorry because I appreciate the work you did. But if we get something different but better than hack, why not :)
 
@marcio well, there's nothing inherently bad with what Hack did.
 
I think the cat is getting somewhere with his fn proposal... at least it could bring sugar to class methods too.
 
@marcio don't know...
The issue with these RFCs is that they bring something new to PHP, which certain people already oppose by default. And then a few people bitching about what mnemonic the operator should be…
(Yes, I admit being one of these…)
 
11:23 PM
I'm very deceptive with bison limitations (not exactly bison), it got to a point we're struggling too much with workarounds and we end up not getting what we want.
 
but that ends up in the RFC getting not enough Yes-votes…
@marcio teh magic is glr.
 
> My primary idea was, as you suggested, to provide a variable_exists() function, restricted to variables, an hasitem() construct, reserved to array elements, similar to array_key_exists(), and consider that property_exists() is sufficient for class properties.
 
@marcio shit. he means that seriously.
 
I will be a strong -1 just for the keyword
 
11:30 PM
who writes code that depends on a variable being declared or not
 
@marcio I'm not even commenting on that
 
@marcio I.
 
@bwoebi you're doing it wrong then
 
O_o
 
But… that's just because I'm too lazy to init vars to = null;
 
11:32 PM
@bwoebi I meant a $variable not an index on some array.
 
@bwoebi I am going to order you a book
 
@ircmaxell you should find a nice girl to help you explore those masochistic tendencies
 
STOP USING NULL TO INDICATE ANYTHING OTHER THAN YOU F&%#%(ED UP. IT IS NOT A VALID APPLICATION VALUE. The sooner people get that through their heads, the sooner we can build *robust systems
 
@marcio yeah. But these times where I really did that are long past.
 
null means "I don't know. If you want to pester me about it, I'll crash your program."
 
11:34 PM
there we go, 75k results: github.com/…
 
@ircmaxell ehm… you know about that context sensitive lexer thing?
 
@bwoebi you reviving it?
also, NO
 
@bwoebi I told you guys he was dangerous.
 
@ircmaxell I mean the patch @marcio merged?
 
if ($x) {
    $y = null;
}
if (exists($y)) {
   // something something...
} else {
   // something
}
 
11:35 PM
those exists() fragments seem to mostly be an AR related crap
 
@bwoebi I must be blanking, I don't remember it being merged
 
@ircmaxell few months ago already.
 
this will be my new githook: if PHPparser finds the T_EXISTS token it bails out.
@ircmaxell he means the RFC that allowed reserved words to be introduced without clash with class members $x->exists().
This will still break functions though. But the bc break is not the issue for me.
 
@marcio it's the non-starter for me...
 
# I already have done this: because too lazy to use an extra boolean.
if (condition($x)) {
    $y = $someValue;
}
// code…
if (isset($y)) {
   // something something...
} else {
   // something
}
 
11:39 PM
@bwoebi a word of advice from someone who's been doing this a while: DON'T DO THAT
maintainability is a thing.
reducing pain of making things unmaintainable is not a goal we should be striving towards
 
@ircmaxell As said… I have done this. Not that I'm currently.
At least a lesson I learned from being in a register_globals env… always declare your vars first.
 
if (exists($x) && isset($x)) {
    /* bugs[] = bug */
} else if (! @isset($x)) {
    /* bugs = array_merge(bugs, bug) */
}
 
(I haven't learned it the hard way, but it taught me the potential dangers.)
 
function foo() {
    global $bar;
    if (exists($bar)) {...}
}  // AmIDoingItRight?
 
@Ghedipunk that'd be always true anyway… because global $bar is implicitly initializing to NULL.
 
11:43 PM
@bwoebi Which only adds to how wrong it is...
 
right.
Anyway… I hate it to hate my own code ^^
 
I'm pretty sure I've done stupid things like that myself... and I'm not saying I'm any better now, I'm just more subtle about my stupidity.
 
@marcio by the way… the way to check for exists() is: @$foo == ($php_errormsg = null) ?: ($php_errormsg == null)
 
@bwoebi another thing, doing it with isset is a little bit less horrible than doing it with exists()
 
Can we deprecate @ please?
 
11:48 PM
@Ghedipunk no. There are enough socket functions which may trigger some warnings you don't need. Also, the perfect include... etc.
basically everything dependent on I/O needs the ability of warnings to be turned off.
 
@Ghedipunk No - it's really useful. For some people mkdir failing is an exceptional circumstance. For others it's not. Having the squelch operator allows both people to be happy. As Bob said.
Anyone know what makes running php tests fail to fail on errors in Travis ?
There are failed tests - and it's exited with 0.
 
@Ghedipunk unless you put something better in place.
 
@marcio Exceptions... loggable warnings... It would be a lot of work to put it into PHP itself, and I'm not nearly well versed enough in C to do it myself, much less in the internals of PHP... Maybe if I were to implement something like that it might make it into PHP 10.
I'd love to help... I'm sure there has been penty of discussion about it already, too...
 
good morning all! :)
 

« first day (1802 days earlier)      last day (3161 days later) »