« first day (2182 days earlier)      last day (2992 days later) » 

15:00
@Trowski You can request a Promise there, but you do not have to
@bwoebi but what if I do async foo() and foo() doesn't do any io?
@DaveRandom then it'll be just an immediate success promise
I also don't get the point of this then, because anything that does io is implicitly a promise/task/whateveryouwannacallit and anything that isn't the behaviour won't change
@DaveRandom how do you mean "anything that isn't the behaviour won't change"?
or are you saying that calling an async function would block by default and you have to explicitly say you don't want to wait for it to finish?
15:03
@DaveRandom yes
(it would block that particular current coroutine)
DKIM private key should probably be a standalone key right? Not linked / used anywhere else
@bwoebi right, that's what I mean
That could possibly make sense I suppose, but it would be really confusing for people who work with other languages with async/await
I do see the rationale though
@DaveRandom That's one of the things I valued highly when coding Go … … though Go had the drawback of being actually multithreaded by default requiring mutexes thus
@DaveRandom It would be quite natural to the Go programmer :-P
15:06
I guess requiring await at call time does leak implementation info
why? … wait … I think I'm misunderstanding? … I do not require anything, you just need to prefix async if you want to not wait for it?
Hi everybody, I have a quick question that hunt me for a couple of days... I'm using SimpleMVC and I disabled them error reporting system by commenting

//set_exception_handler('Core\Logger::ExceptionHandler');
//set_error_handler('Core\Logger::ErrorHandler');

and adding : error_reporting(-1);

But now that I see errors, I don't have line where the error occurs...

: Undefined index: user in on line

: Trying to get property of non-object in on line

: Undefined index: user in on line

: Trying to get property of non-object in on line
@bwoebi Well if I have to do await $httpClient->request() then I have to care about whether it's async or not, with your suggestion I don't (a blocking HTTP client would work identically with the same code)
Which would certainly be useful in cases where it's hard to decouple a protocol implementation from the transport, as it often the case with API client implementations
@DaveRandom precisely - and you can just prefix async if you want to do other things in the current context
15:10
If you look at .net it's full of Foo GetFoo() and Task<Foo> GetFooAsync() type things, with your suggestion that disappears
@Trowski ^
I found a validateDate function off php's manual, I'm trying to make sense of the return statement.
function validate_date($date, $format = 'm-d-Y H:i:s')
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
yeah, that's what's been annoying me
I think I'm on board
Additionally, I think my suggestion could be even implemented more efficiently
I give up trying to format it
can someone explain how return $d && $d->format($format) == $date; works? is it just a slick way of comparing $date to the $format?
15:11
evenin
i.e. currently we need to have a separate generator for every single async stack frame… now we can just have one stack per execution context @DaveRandom
@Tiffany make sure that createFromFormat() returned something truthy (it returns false on failure) and that format() gives the same result as the input
it short-circuits on the first condition if creating the object failed
if you didn't test that, then the ->format() would result in an error because you tried to call an object method on bool(false)
@Tiffany post 2 messages
@DaveRandom thanks
Wes
Wes
@Tiffany since nobody trusts == on DateTime objects, they compare strings as it is more reliable, probably
@bwoebi took me a while to get this but yeh, also makes sense
15:15
@DaveRandom yeah, it's what we do now, just backwards :-D
@bwoebi @DaveRandom Yeah, I see it now, that makes a lot of sense.
It just needs a poor soul to implement that
@Wes are DateTime objects notorious for having issues on ==?
/me points at himself (???!?)
I need to find an intermediate class on PHP...
or maybe I should start with a basic class x_x
15:19
@bwoebi I think you are by far the most qualified for that task.
@Jimbo imdb.com/find?ref_=nv_sr_fn&q=bollocks&s=all I dont comment public posts, so pick one of those to troll people ;)
Wes
Wes
@Tiffany DateTime objects are notorious for having issues. <- sentence ends here :P
@Trowski yeah, most likely…
Wes
Wes
you can extend DateTime and implement that in the constructor, like many do
And I do need to do this in the next few months if we want to discuss this until 7.2 …
15:22
@bwoebi I'll be happy to assist with RFCs or anything I can, but the generator stack is way beyond my internals knowledge.
@Wes should I use DateTime, or should I use something else instead?
Wes
Wes
anything built over DateTime i tried sucks, not their fault, they just inherit problems from ext/date
@Tiffany just use datetime, it works well enough
@Tiffany you should use DateTime
Wes
Wes
@Tiffany php.net/manual/en/class.intlcalendar.php this is way better, it's not actually documented on php.net but you can find ICU guides anywhere on the internet. api feels bad and confusing... but the library is actually rock solid :B
someone should make a nice userland wrapper of that, and we should all use it
15:33
dont listen to @Wes. You should use DateTime. It will work out just fine.
Wes
Wes
until it doesn't
that's fine. She will not get there anytime soon
@Trowski bah, I'd need to reimplement the generator stack anyway for that
Wes
Wes
but as always to be fair, datetime stuff is hard, and ext/date is a huge library
Also, RFCing is fine, but I need a PoC first ^^ @Trowski
15:37
Did I hear generator stack
@NikiC Any thoughts before moving arrow functions to discussion phase?
@bwoebi Of course. Hmm… I had hoped you could build it on top of the existing generator stack, rather than reimplementing it.
@LeviMorrison nothing specific, apart from a strong suspicion that => isn't gonna fly
@NikiC You think more people would go for ==>?
I think that ==> would be a more conservative choice. There are also so many other controversial points in that RFC that adding syntax ambiguity on top is probably not a good idea
@LeviMorrison Yeah
15:44
Unfortunate.
Hmm.
Dart/JavaScript/C# use =>. I feel like this should be compelling enough to overcome the disadvantages.
But perhaps not.
It's times like this that I'm sad Facebook decided to do their own thing rather than try and work with Internals directly.
Everytime I see ==> I cry a little inside.
$x => 42
$x ==> 42
It seems to put the body so far away.
Plus I'm used to the JavaScript/Dart/C# syntax.
@LeviMorrison It's one character, you still save the other 70 or so
@LeviMorrison I'd also consider dropping the last example. It's very hard to understand and probably does not make a good case
@NikiC Oh, I don't about typing another character. It just visually feels like it separates, not connects.
(the groupByKey one)
map($x ==> $x['name'], $data)
map($x => $x['name'], $data)
@NikiC Dropped.
$result = Collection::from([1, 2])
    ->map($v => $v * 2)
    ->reduce(($tmp, $v) => $tmp + $v, 0);
$result = Collection::from([1, 2])
    ->map($v ==> $v * 2)
    ->reduce(($tmp, $v) ==> $tmp + $v, 0);
Those look okay. This bothers me though:
  $calculateSize = $family ==> {
    $counter = 0;
    foreach ($family as $member) {
      $counter++;
    }
    return $counter;
  };
I think this is better:
  $calculateSize = ($family) {
    $counter = 0;
    foreach ($family as $member) {
      $counter++;
    }
    return $counter;
  };
@NikiC It's about this insane idea which will require either backing up the C stack or convert zend_call_function callers to be split into a caller and a callback upon completion
15:56
Memcache + MySQL for session sharing across 2 servers + a MySQL box? Y/N
Using Memcache for sessions is a bad idea.
People just "randomly" lose their sessions.
Yeah
@LeviMorrison missing => intentional?
@bwoebi meh
Hence the MySQL fallback
Really wish I could have a deciated redis box or something for it, but money.
@NikiC Yes. Dart drops the => and I really prefer it that way.
This way we can equate => expr to being { return expr; }. Very clean.
15:58
@NikiC C sadly has no native generators…
@Sean redis?
Oh you said that :p
The symbol { isn't a binary operator so I don't think an arrow is required for disambiguation or anything.
> PHP might start using => for other purposes in the next few years that might conflict with using => for lambda expressions.
@LeviMorrison that's right, but then we have no shorthand return
or do you want both?
I want arrow expressions.
If we support blocks then I'd prefer dropping the arrow symbols (not arrow expressions).
ah ok
16:03
Also, if anyone points out that having more than one way to define a closure sucks I'll just point them to Swift/Ruby which have 4 different ways.
^_^
Okay, Swift and Ruby suck too!!!!
:-D
Anyway, one of the main reasons Hack picked ==> is this:
> PHP might start using => for other purposes in the next few years that might conflict with using => for lambda expressions.
The other reason is already known, but I think they have something wrong:
> trying to co-opt => for lambda expressions leads to some ambiguous cases, and the different possible schemes for arbitrarily resolving these ambiguities all felt like they would catch the developer by surprise and cause confusion/frustration and increase how often things needed to be wrapped in parentheses.
There are exactly two cases. I also don't anticipate that arrow functions will be routinely used in those contexts anyway.
It will happen, but it's definitely not going to be as common.
Honestly their choice of ==> is mostly arbitrary:
> We all went into the woods with pens and pads of paper and ate hallucinogenic berries we found to come up with ideas. Someone suggested two equal signs followed by a greater than sign and we all burst into uncontrollable laughter. The laughter was followed by intense philosophical introspection into the nature of symbols, and how it's weird that we draw two parallel lines for the equal sign, and how it's fun to think about how they decided which symbols went on the standard keyboard.
> As the effects of the berries wore off and we started to walk back, we looked at the ==> symbol we had written down and thought about how it all fits together with the abstract architecture of the universe, and how it strikes a chord within us that gives a calming sense of harmony with the world.
This is from their official docs: docs.hhvm.com/hack/lambdas/creation-story.
Wes
Wes
what's your preferred syntax now @LeviMorrison ?
() => expr
singleParam => expr
($param1, ... , $paramN) => expr
This is what Dart/JavaScript/C# do.
Wes
Wes
are parens obligatory everywhere except single param?
16:12
These are not weird languages. JavaScript and C# are two of the most mainstream languages available today.
@Wes Yes. I know that makes some people uncomfortable to allow omitting them in that case but basically everyone allows it and people do use it.
It's even preferred.
Wes
Wes
the fact they are obligatory is a consequence of => or they would be obligatory regardless of that?
I mean theoretically we could allow $x, $y => $x + $y
We don't permit arbitrary , right now so it would work.
Maybe wrap the whole thing in paren? ($x, $y => $x + $y)
@LeviMorrison ambiguous in function calls
and arrays
anything that has commas ^^
Wes
Wes
@LeviMorrison no, because you end up with ))))))
@LeviMorrison that tends to look ugly
16:17
Yeah; consider no-args: (=> $x + $y)
Wes
Wes
$c = ($p1, $p2, $p3) =} $p1 * $p2 * $p3;
$c = ($p1, $p2, $p3) {} $p1 * $p2 * $p3;
$c = ($p1, $p2, $p3) fn $p1 * $p2 * $p3;
Anyway, I think Dart/JavaScript/C# have a good design and I honestly don't think the 2 ambiguities caused by using it are a big deal.
But I know there will be those who disagree.
OMG WE ALREADY USE THIS SYMBOL ABORT ABORT
Wes
Wes
i quite like the fn one
Yeah
That's more readable
Wes
Wes
@LeviMorrison if there is another symbol that works and looks just as good, though...
16:20
@Wes =} is the best one but awkward
At least with all the symbols I've tried I think ==> is the only other viable symbol but realistically I don't think ==> and => are so different that they wouldn't make a human have to look twice. If you have to look twice why not use the the shorter symbol which is the same as Dart/JavaScript/C# anyway?
@Wes yeah, not likely I'll encounter the issues with DateTime ... any time this year ...
hell, probably the next few years
There are languages that use sequences like '> that could be used but I don't think Internals would agree to them. They seem very odd and out of place in PHP.
(And they'd break all sorts of syntax highlighters! How fun!)
@LeviMorrison Ah, that's the first real argument in favor! :-P
Wes
Wes
how about reducing => ambiguity by adding a prefix, like so:
fn $p1, $p2, $p3 => $p1 * $p2 * $p3
@Wes That removes all technical ambiguity, yes.
It does not remove the whining about =>
@Wes you're just regurgitating old ideas ^^
Wes
Wes
also no need for parens
i hate nested parens
@bwoebi i didn't participate :P
:-P
I wrote a draft that used fn, and a draft that used ^ (which symbol is used for this same purpose in Objective-C)
16:25
@LeviMorrison The prefix would probably resolve the whining about => as well ^^
but we already discussed that ... reserved keyword
Yeah, it can't be letters because of bc breaks + it can look like a function call.
Has to be a prefix.
And of those symbols I think only 2 are remotely viable: \ and ^
gah
TIL that the undefined constant fallback also triggers in namespaces
for some reason I though that it was disabled for namespaced code
^$x => $x + 2
\$x => $x + 2
Wes
Wes
tbh i prefer fn, and i'd have fn as alias of function everywhere, fn foo(){} === function foo(){}
It's definitely a BC break that will affect projects.
Don't have to go very far to find them: would break a library of NikiC's and also breaks tests in PHP core that used fn as function names.
@NikiC Head up an RFC to remove barewords in PHP 8, please!
16:36
@LeviMorrison +g_64
Using ==> still has conflicts with Hack, correct?
Wes
Wes
or, i would use {} because in my mind they resemble function/closure, like
{} $a, $b, $c > $a * $b * $c;
{{ $a, $b, $c > $a * $b * $c;
@LeviMorrison example one liner of a closure returning another or more closures?
@Trowski No; the proposed RFC as written with changing => to ==> is a subset of Hack.
@Wes In which flavor?
Wes
Wes
js? any example that makes sense
16:46
x => y => x + y
^ Javascript/C#/Dart
$x => $y => $x + $y
\$x => \$y => $x + $y
$x ==> $y ==> $x + $y
^ In the various proposals
I managed to not look at the poll results for 10 minutes. Is that a success or a failure?
Umm... How do I tell amp to wait for a promise to be fulfilled? There was something like wait() but I can't remember... :/
Wes
Wes
not worst case scenario enough LeviMorrison
($x1, $y1) => ($x2, $y2) => [$x1 + $x2, $y1 + $y2]
\($x1, $y1) => \($x2, $y2) => [$x1 + $x2, $y1 + $y2]
=> $x1, $y1 => $x2, $y2 => [$x1 + $x2, $y1 + $y2] // how about having => as prefix?
{{ $x1, $y1 {{ $x2, $y2 {{ [$x1 + $x2, $y1 + $y2]

['arrKey' => => $a, $b, $c => $a * $b * $c ] // it reads surprisingly good
i like the third one, no parens, repeating pattern for nested ones
and => could be anything i mean
~> $x1, $y1 ~> $x2, $y2 ~> [$x1 + $x2, $y1 + $y2]
~> int $x1, int $y1 ~> int $x2, int $y2 ~> [$x1 + $x2, $y1 + $y2]
The { need to be balanced }.
@LeviMorrison Aaaah, I love tied votes
Ah, \Amp\wait()
16:58
@bwoebi :)
@Archer this is only to be used in synchronous contexts, you know?
@bwoebi yep ;)
\$x => $x + 2 seems most natural to me, as Haskell roughly uses the same syntax
Am not doing anything async atm
@PietervandenHam well, that syntax is inspired by Haskell.
16:59
@bwoebi that should be it
Wes
Wes
my vote is to anything that doesn't use parens (unless very close to each other, like an operator, not for "grouping" stuff )
\$a, $b, $c => $a + $b + $c would this be fine without parentheses? i like it
@Wes I don't know … looks a bit weird
\=> 1 … a Closure returning 1??
Wes
Wes
yes
except: \ \MyNS\MyClass $a, $b, $c => $a->getVal() + $b + $c
that is not good
Typehinting in lambdas? That almost entirely destroys the brevity.
can someone explain to me why this is becoming falsy? if ( !(validate_date($_POST['birthdate'], 'm-d-Y')) || !(validate_date($_POST['birthdate'], 'm/d/Y')) || !(validate_date($_POST['birthdate'], 'm.d.Y')) )
function validate_date($date, $format = 'm-d-Y')
{
	$d = DateTime::createFromFormat($format, $date);
	return $d && $d->format($format) == $date;
}
Wes
Wes
17:07
=> \MyNS\MyClass $a => \MyNS\AnotherClass $b => $a->val * $b->val
equiv of
function(\MyNs\MyClass $a){
    return function(\MyNS\AnotherClass $b) use($a){
        return $a->val * $b->val;
    }
}
@Tiffany how so?
@Wes it's returning true, but the conditional is running for some reason
if ( !(validate_date($_POST['birthdate'], 'm-d-Y')) || !(validate_date($_POST['birthdate'], 'm/d/Y')) || !(validate_date($_POST['birthdate'], 'm.d.Y')) )
	{
		$error_msgs[] = "Birth date must be a valid date.  Verify that the date is in MM/DD/YYYY format.";
	}
I have the "Verify that the date is in MM/DD/YYYY format" just so that they put the year in YYYY format
Wes
Wes
simplify that if
that's what I was thinking, but I'm not sure how
:/
if { ... } else if { ... } else if { ... }?
I'll try this
 	if (!validate_date($_POST['birthdate'], 'm-d-Y'))
	{
		$error_msgs[] = "Birth date must be a valid date.  Verify that the date is in MM-DD-YYYY format.";
	}
	else if (!validate_date($_POST['birthdate'], 'm/d/Y'))
	{
		$error_msgs[] = "Birth date must be a valid date.  Verify that the date is in MM/DD/YYYY format.";
	}
	else if (!validate_date($_POST['birthdate'], 'm.d.Y'))
	{
		$error_msgs[] = "Birth date must be a valid date.  Verify that the date is in MM.DD.YYYY format.";
	}
lol
I'm almost tempted to print this code out just so I can tear it into shreds. Deleting it isn't dramatic enough.
Wes
Wes
17:27
3v4l.org/0WPTd @Tiffany
I don't follow why you're using an array?
Wes
Wes
they are just some test cases
mmmm
fair enough
nevermind, my brain is starting to fray at the edges
Wes
Wes
3v4l.org/vGKLV you just need this
I see
just one exclamation mark
I had to stare at your code for a while
Wes
Wes
17:33
it happens when you do boolean stuff with plenty of negations
sorry
Wes
Wes
no probs :B i've been noobing too :B
and, i still often go full retard with boolean expressions with negation, and and or mixed
making stuff simpler helps, especially negation, i always try to have fewer ! as possible
yay, it works, thanks
Wes
Wes
yw
alright, lunch time
17:41
@Tiffany Holy if statement batman
Move all that crazy into the function
@PeeHaa y batman?
Ah right. I forgot that not everybody is 16+ :P
...
!!urban holy batman
[ Holy Batman ] Words used in the beginning and ends of a phrase to express surprise. Originated from the popular comic book series 'batman' his faithful sidekick Robin used to say 'Holy______Batman!' perhaps when he saw a villain. Today it is commonly used for the same reason, to express shock or surprise. It is used simply by stating what you see between holy and batman, this shows that this is shocking.
17:45
sou ka
@PeeHaa That was a bit too self-referential…
Well thank you
:-P
18:04
@NikiC could you ping me when you're around please?
Anonymous
cool Ad
@JayIsTooCommon They are really fucking over the nexus users :P
Anonymous
18:21
:p ikr
@JayIsTooCommon dude... I'm a google fan like some ppl are Apple fans... I want that phone, even though I love my current phone, too
@PeeHaa not just the users.......imagine how the companies that manufacture Android phones are feeling right now.
Yeah. Such a terrible idea
They basically fucked everybody involved
nexus users, normal users, manufacturers
to be fair - Android was always a trap.
Join me for the ongoing 1996 revival! Clinton is president, everybody's talking about VR, and there's a startup that delivers groceries!
True but alphabet made it go faster
Now let's hope nokia can make a proper comeback
It won't happen, but one can dream
18:36
@PeeHaa will buy a pixel in march i guess. when price is down
18:49
@PeeHaa I'd be better off just making a new function that calls validate_date
Basically you are trying to hide complexity. But you only hid part of it
It should just do a full validation based on your business rules instead of having to think about stuff like formats when calling it
I have a few parts of validation that are exposed outside of a function
shrug, I'm nearing completion with this, so I'm going to be posting it to CodeReview hopefully sometime this week, so it can be butchered
butchering ftw \o/
@PeeHaa that sounds fishy because it contains a hering
Thanks dad
19:00
yw son
:P
19:16
I'm editing a PHP file and then typing make
… I perhaps should code a bit less C, lol
good morning
Wes
Wes
@JayIsTooCommon :D headphones jack not new
@Wes it's a dig at iPhone
Wes
Wes
:P
in JavaScript, Sep 27 at 18:04, by Wes
i always enjoy apple products destruction videos
and anything ridiculing apple
19:41
heh
Anonymous
@Wes ikr :p good marketing
eevenings
Wes
Wes
\o
\o
Anonymous
19:43
Hoi Ekin
hOi
Wes
Wes
why is @kelunik showing off here twitter.com/kelunik/status/784110530453700609 :P
i know that, tell me one use case of saving stuff belonging to a tab only
it's pointless
Anonymous
:D
Anonymous
@PeeHaa how's Twitoo api going?
It's... going :P
Anonymous
19:46
lol
is it going like a beer or a scotch @PeeHaa?
Anonymous
I've made lots of progress with Webnews btw Patar
@Ekin Scotch for sure
@JayIsTooCommon Did you really? :)
Anonymous
Yeah, cloned it and everythin
Well that is the first step :)
Do you have it actually running yet?
Anonymous
19:49
Nope. Cloned it, realised it required PHP 7 (I'm 5.6 because work) and turned off my PC
Anonymous
But it's a step in the right direction :D
@JayIsTooCommon that's easily 90% of any job
@JayIsTooCommon docker run -it php:7 /bin/bash :P
@Gordon moah, then I even need to fire up docker-machine
you're really kidding me when you're expecting that much effort?
Anonymous
19:54
:P
@kelunik docs.kelunik.com is 500 for at least two days now. fixitfixitfixitfixitfixitfixitfixit
I blame bob's amp stack
@Gordon I see no 500?
^++
@bwoebi cheater
Anonymous
19:58
Works for me
@Gordon I have no access to that server
user924016
mornings
@bwoebi then kelunik fixed it as we spoke. it was 500 a minute ago
I call hax
@Gordon Or you just had a cached 500?
19:59
@bwoebi or maybe that

« first day (2182 days earlier)      last day (2992 days later) »