« first day (1587 days earlier)      last day (3374 days later) » 

9:00 PM
Apparently Hack just got a language specification: hhvm.com/blog/8537/announcing-a-specification-for-hack
 
@bwoebi @NikiC @JoeWatkins @ircmaxell Just a heads up for guys that seemed interested on the semi-reserved words RFC: After some careful deliberation I made a little effort and expanded support to namespaces, classes, interfaces and traits names.

RFC: https://wiki.php.net/rfc/context_sensitive_lexer
TLDR patch: https://github.com/marcioAlmada/php-src/commit/77225b8f5d60146c6575e95ebfca2196bf3953a1
Full patch with tests and all the things: https://github.com/php/php-src/pull/1054/files
I'm currently working on the additional typehints support which is sort of broken right now. The bug seems easy to fix so the intention is to put the RFC into discussion on Monday. I'll leave it here to be scrutinized while I expand the draft RFC with more information.
 
23,252 Zend/zend_language_scanner.c View
19,407 additions, 3,845 deletions not shown
So many :o
 
@marcio RFC looks good
 
@bwoebi is this an issue? It's all generated code.
 
no… I just was surprised…
 
9:08 PM
@bwoebi I suspect the added lookahead generates significant complexity
 
possibly. Is there any perf difference @marcio ?
 
very good question
 
The RFC says no, but it does not say how this was measured
 
@bwoebi I couldn't notice any diff, I'll have to make a serious benchmark at some point though.
 
@marcio Did you perform dedicated lexing performance tests?
 
9:10 PM
@NikiC I added an entire library inside an if(false) statement and run it like 100.000 times.
 
@marcio k
 
@marcio perhaps write a sapi which just stresses the parser (that way you remove more noise)?
 
@ircmaxell indeed, I noticed the diff for the generated file increased after the lookahead macro was defined. But it might not be the only reason.
 
sure, and that's not always a bad thing, so look forward to seeing structured results :-D
 
@marcio I think you could do with a better example: class Collection { function list() {} }
Also, a typo: delcare :)
Other than that, I fucking love it :)
 
9:14 PM
@Narf please, if you have more better user space examples add it to a gist and I'll put it in the RFC by the weekend.
 
@ircmaxell I'd say token_get_all() gives enough approximation for measuring differences @marcio
 
@bwoebi perhaps, yeah that seems reasonable
 
@marcio Nah, just this one example ... I often want to use list() as a method name.
But I'll tell you if I think of something else of course.
 
@marcio Typo in the extends/include example.
That is, it says extends in the comments, but is include in the code.
 
@bwoebi token_get_all() spends the vast majority of time creating arrays, not tokenizing ;)
 
9:17 PM
@NikiC I know. But differences of 1% in lexer time are measurable.
 
user895378
> Scalar Type Hints v42.34.18
 
=)
 
user895378
^ Apparently we're using Federation star-dates for RFC versioning these days.
 
@rdlowrey forgot the "HIKE"
 
Still better than Chrome. ;)
 
user895378
9:19 PM
lol
 
user895378
v42.34.18OmahaOmaha
 
@bwoebi I preview memory exploding if I do the same tests with token_get_all, but I'll give it a try.
@rdlowrey v42.34.18.NaN.NaN
 
at least building the array should be much faster than compiling and parsing…
 
@rdlowrey I already see the "PHP is a web-oriented language" replies ...
 
user895378
-________-
 
9:23 PM
Hi everybody, I came here earlier to ask how to throw error on ajax call with wordpress. Someone point me to Exceptions and return proper http header, but I was wondering wich number http error number do I have to return?
 
@JonathanLafleur Choose wisely - but basically; 4xx the client did something wrong, 5xx the server did something wrong.
 
Thank you ! I'll look at this, but I just found wp_json_send_error()
 
@rdlowrey I think you should adjust the wording around exceptions. If an exception is thrown the generator is no longer valid
 
@NikiC is return populated in that case?
 
9:35 PM
@ircmaxell no
 
but it's also not an error, correct?
 
it is an error
accessing the return value of a generator that has thrown, that is
 
how do you know? ->valid() is false, but ->getReturn() throws an error?
doesn't that seem a bit...odd?
 
no
In the applications this is targeting, if the coroutine throws it means it must be unscheduled (and the exception forwarded to where the coroutine was "called" from). Accessing the return value in that case is a bug
 
@marcio moving the section "The proposed change, if approved, also gives more freedom to userland fluent interfaces or DSL like APIs." to right near the start, might be a good thing. It's a more powerful argument for the RFC than the first couple of pages (imo). Also the text "but currently fails because 'extends' is a globally reserved word" may be in the wrong section? There is no extends.
 
9:38 PM
@NikiC yes, but shouldn't there be some mechanism to detect that in the generator?
 
@ircmaxell I don't think that it would be useful
 
hasReturn() which does both ->valid() and thrown checks?
 
@ircmaxell You can just catch the exception if you really need to know this
 
fair enough
 
function hasReturn(Generator $gen) {
    try {
        $gen->getReturn();
        return true;
    } catch (Exception $e) {
        return false;
    }
}
> 1. Argument Mismatch (not passing required parameter, passing invalid
parameter, etc)
2. Parse Error (eval, etc) - note this appears to be implemented already
3. Methods On Non-Objects (call to a member function on null)
4. Call to undefined method (this should be a separate exception from ^^^)
@ircmaxell ^-- and should all of these not caught by default as well?
 
9:42 PM
I would assume so
I'd love to reuse InvalidArgumentException for the first one, but...
 
In other news, we now officially have a revenge RFC. :D
 
@Danack thanks, fixing... you should be the official room11 RFC reviewer, BTW
 
@ircmaxell And why should these in particular be subclassed?
btw, right now ParseException inherits from BaseException not EngineException
 
@NikiC what's the inheritance order?
 
@marcio you guys would need to use simpler words for some of the RFCs.....(possibly not actually a bad idea...).
 
9:45 PM
BaseException (abstarct)
 +- EngineException
 +- ParaseException
 +- Exception
     +-ErrorException
     +- all other exceptions
copied from dmitry's mail
 
@NikiC because they are things that commonly are runtime-based errors, and as such are more common to be pivoted on
so ParseException isn't an EngineException? interesting
(not that that matters)
 
user895378
@NikiC updated.
 
@NikiC or to write that another way, I have code that I could restructure if I had the ability to catch only those specific classes
 
Uh, yet another RFC…
 
user895378
YAR!
 
9:54 PM
oh, I found the April 1 RFC
 
Then YAR from @kelunik, then YAR from @rdlowrey and then probably YAR from Zeev in the next days… phew…
 
the tabs/spaces switch for scalar types
 
Weren't you looking for something believable? :)
 
user895378
Should I announce a yield from RFC in the next three days in the hopes that someone can get a working implementation done in the next two weeks for a vote and inclusion in 7?
 
user895378
/cc @NikiC @bwoebi ^
 
user895378
9:58 PM
And just not worry about it if not?
 
you can… I won't be able to work on anything before Monday… but Nikita may…
 
@rdlowrey which would what? proxy to an inner generator?
 
poooh, writing RFCs is far too much like hard work :/
 
user895378
@ircmaxell yes. Essentially. It's not required, but it makes writing asynchronous code that feels synchronous easier.
 
user895378
Pulling directly from the relevant python docs:
 
user895378
10:08 PM
> The main principle driving this change is to allow even generators that are designed to be used with the send and throw methods to be split into multiple subgenerators as easily as a single large function can be split into multiple subfunctions.
 
can you give me an example of what that would look like?
 
user895378
sure ...
 
@NikiC Just yesterday I was told off for suggesting a base Object :P
 
Something something we could just use an interface....but apparently it's already been implemented.
 
@Danack properties
 
10:11 PM
@ircmaxell Yeah. I still don't get that. People who extend Exception can still do so. Where's the issue lie?
 
@DaveRandom I have create an alias to a local mailbox, which is just a forward to the external address :P
 
what if an extension wants to extend EngineException?
 
Good for it?
 
well, but having BaseException be a class, the property system can be common among all exceptions, rather than having to implement them specifically on each side
 
That's what always what I think - I know I can share this code amongst these classes to save retyping it....and then 3 months later I realise that they're actually separate things.
 
user895378
10:14 PM
@ircmaxell So here's a real-world example of how yield from would be used in my http server:
 
user895378
function myHttpResponder($req, $res) {
    // execution resumes when the promise returned from myAsyncCall()
    // is resolved successfully and the result is stored in $a
    $a = yield myAsyncCall();

    // $d gets the return value $c from the nested generator
    $d = yield from myNestedGenerator();
    $res->setStatus(200);
    $res->send("<html>hello world: {$d}</html>");
}

function myNestedGenerator($a) {
    $b = yield mySecondaryAsyncCall();
    $c = yield myTertiaryAsyncCall($b);
    return $c;
 
@marcio it's OK bro, I'll remember who implemented it :)
 
@rdlowrey then $d would be equal to $c from "myNestedGenerator"?
 
user895378
@ircmaxell yep
 
interesting
seems reasonable
 
user895378
10:15 PM
It basically allows you to treat the yielded things in the nested generator as if they were in the parent.
 
user895378
(as opposed to what I have to do currently -- convert each individual generator into a promise and resolve it individually to get its eventual result)
 
user895378
So I already have the capability now, but adding yield from would simplify it and make it faster.
 
user895378
This was added to Python in 3.3: docs.python.org/3/whatsnew/3.3.html#pep-380
 
and make it easier to understand in the middle layers
 
user895378
And it's a thing in ES6 via yield *
 
10:18 PM
@Leigh wat? oh no, I only cited the twit because it is a true.
 
@marcio s'ok, bro :)
 
So, I hear you like RFCs, but I hope this doesn't need one: github.com/narfbg/php-src/commit/…
Can anybody tell? Is it a good idea at all?
 
can a RFC be put to vote like one day before the feature freeze? I still have 2 RFCs to finish xD
 
@rdlowrey my ridiculous "lets write crypto in PHP" senses are tingling, a generator to yield blocks and a return value for a MAC that is updated on the way.... off to the laboratory!
 
user895378
@Narf Without having looked at what it actually does, I would say a new function in an existing extension like that could be handled with a PR and not a full-blown RFC.
 
10:21 PM
@marcio It always can, but they'll probably tell you to target the next release :D
 
user895378
@Leigh Speaking of, what shook out with random_*() has that happened yet? If not I think we need to do an RFC in the next three days.
 
Well that probably depends on the complexity of the change
 
@rdlowrey Great, thanks.
 
user895378
@Narf but you'll want to do your PR with the accompanying explanation in the PR message sooner rather than later.
 
@rdlowrey grumble, trying to coax @SammyK along, but he seems pretty busy. If he hasn't found time by the weekend, I'm just going to PR everything I think needs doing to his branch
 
10:23 PM
@rdlowrey Yes, of course ...
 
I've done a ton of research, and have a much better understanding of my ideal now
I'm basically planning on stealing some of libressl-portable
 
user895378
@Leigh works for me :)
 
@rdlowrey The thing I'm wondering about here is why the "async calls" aren't also using yield from
 
Not sure we'd need to RFC the functions themselves, they are all self-contained and non-breaking. However, if we want to apply the CSPRNGs to stuff like session_id generation, or propose the deprecation of mcrypt_create_iv at the same time, I think we'd have to RFC it
 
user895378
@NikiC they could if those calls were generators. But with my particular "framework" any time I yield a Promise instance the server knows not to resume execution until the promise resolves (if successful). If it fails then the exception is thrown back to the generator.
 
10:27 PM
@rdlowrey k, guess it depends on the details of how one wants to implement async calls
 
user895378
Yeah it does.
 
@Narf update it for 7 (using zend_string)
 
@ircmaxell zend_string on what exactly? It's based on master and I took hash_pbkdf2() as an example to follow, I'm not really familiar with the zend_* stuff
 
oh, ok, thanks
 
10:34 PM
@ircmaxell is there any gain in this function to use zend_string*?
 
user895378
@NikiC My coroutine resolution is pretty similar to how it's usually done in javascript land: I just yield promises whose underlying async operations are all resolved using the same underlying non-blocking event loop. That way the event loop lib acts as the task scheduler for everything. When promises resolve in some future tick of the event loop the generator from which they were yielded is resumed.
 
@bwoebi clarity.
that's the only one I can think of
 
@ircmaxell And the disadvantage is not using stack memory but using a pointer.
 
Phew, busy day.
 
@bwoebi which is happening anyway, no?
 
10:36 PM
Have I missed any comments or discussion on Comparable getting proposed?
 
@ircmaxell yeah. Just that's all in the same memory region then.
 
49 mins ago, by bwoebi
Uh, yet another RFC…
@bwoebi I think the only difference is code clarity (putting the lengths and values together)
 
@bwoebi it will just be an offset'd read
 
@ircmaxell but I'd rather not discuss that now. I don't know enough about how caching is affected in such situations...
 
@bwoebi fair enough, but I think new functions should be built using it unless there's a compelling reason not to
 
10:40 PM
(There's nothing worse than discussing things when the other one has absolutely no idea what he's talking about…)
 
@ircmaxell Maybe reconsider block mode for declare. Frameworks like Symfony generate a bootstrap cache file: http://symfony.com/doc/master/book/performance.html#use-bootstrap-files
 
user895378
Best reason evah!
 
valid point.
But you also just can make two files… one with the strict and one with the weak code…
 
@bwoebi complex inheritance relationships may prevent that
 
Anyone have any strong feelings against encapsulation?
 
10:44 PM
true
 
@Leigh ?
 
@ircmaxell like, private classes
 
-1
 
Is that all you have to say on the matter? :)
 
no, I've just said it a number of times
I'd rather see a first-class module system
instead of a hack on string comparison
 
10:46 PM
Well, I guess we'd all rather see a lot of things compared to what we've got :/
 
no, to the point that I think "private classes" really are useless when someone can "fake" the namespace trivially from outside
inner classes? sure
 
Yes obviously you can inject yourself into the namespace, but I see it as more of a "hey, you shouldn't be doing that" tool
 
@NikiC @LeviMorrison @bwoebi what do you think about that block-mode use-case (generated files)? Would that look like namespace block mode? Where no code is allowed outside of declare blocks?
@Leigh first class modules please
 
Is this the appropriate time to announce I quit? :)
Oh well, it's something I was working on before christmas, and someone else came up with a more mature implementation than mine, but I've written the RFC for it, guess we'll see what everyone else thinks
 
go for it
 
10:50 PM
@Leigh is this about the Guilherme Blanco's pull request?
 
@marcio yerp
 
@Leigh I saw the PR some time ago, is it active again? wow, so many things getting aligned on the last corner to PHP7
 
@marcio Yea he was working on it a lot without pushing
 
@ircmaxell I think, our aim is to prevent users from switching all the time. While we won't be able to enforce no switching in global scope files… who uses global scope apart for small tests? I think this is acceptable.
 
Couple of bits still missing, but it's pretty complete (includes reflection etc.)
 
10:56 PM
oh I see, just a bugfix missing according to him.
 
and clone according to me :p
not sure if that requires any special thought
 
clone? I don't think so... should we be disallowed to clone instances of private classes when we shouldn't even have access to the instances in the first place?
 
@bwoebi cool. Thanks
 
@Leigh The main thing it was missing is that it does EG(scope) based checking, which does not work outside of classes
 
I'll have to find my implementation, I started with private functions and hadn't done classes yet
Hm, to clarify, when you say "does not work outside of classes", do you mean "does not work on entities that are not classes"? (i.e. functions)
 
@ircmaxell unsure
 
k, I'll post a question to list
 
@NikiC hey, I'm doing a quick attempt to have php engine to complain when a function is called with exceeding argument count, the implementation is aware of func_get_args and func_get_arg usage thanks to a compile time check but I couldn't find a way to cover the following use case:
function im_dumb_and_do_obfuscated_func_get_args(){
    $fn = "func_get_args";
    $args = $fn();
    //...
}
 
@marcio what about the backtrace method?
note: I'm not being serious there. I'm happy to not support that use-case :-P
 
<?php
function gen() {
    yield *[1, 2, 3];
}
foreach (gen() as $val) {
    var_dump($val);
}

// int(1)
// int(2)
// int(3)
now only the hard part is left ^^
 
11:11 PM
@ircmaxell haha, the problem is that by not supporting the use case the patch would go from "hey I'm adding a good BC break" to "hey I'm adding a potentially annoying BC break"
 
@marcio anyone doing that deserves to be broken
 
@marcio I don't believe that dynamically called func_get_args is a major use-case
 
Ok, I second that, there is no legit reasons to do indirect calls to func_get_args :) and probably no one is doing it anyway
 
However, don't listen to me. I'm not exactly an expert on legacy code :P
I've used two gotos in the last half hour. I'm afraid for my life now.
 
hi5
 
11:14 PM
but just for sake of curiosity, IF I was going to do it, would it be easy on current state of the engine or "impossible mission" status? I'm not very familiar with what's going on zend_vm_def.h land yet.
 
Nothing wrong with goto
 
@ircmaxell I don't even know what that means.
 
user895378
@NikiC \o/
 
user895378
Keep me posted.
 
11:16 PM
Eh, I'm too tired to form a valid opinion. Ask me tomorrow :)
 
will do, and thanks :-)
 
in the end, after becoming fond to the strict mode, declare is actually a good solution... // flees away
 
:-P
 
@NikiC it looks like EG(scope) is populated for function calls too...
 
user895378
@LeviMorrison I think this is an underrated emotion. It's extremely useful to actually tell people when you're feeling this way and I'm trying to do a better job of this when I feel that way.
 
user895378
11:21 PM
Otherwise: burnout.
 
Morning
 
user895378
"I'm tired and don't want to think about that right now," is never the wrong answer :)
 
@Leigh I mean code inside functions (outside classes)
 
@ircmaxell I can see the potential abuse from people already by a feature introduces because symfony needs to do scary stuff
 
@PeeHaa more than one person has brought up that use-case tho
 
11:23 PM
@rdlowrey I'll just make use of this advice right away and stop writing code
2
 
This is UKIP. http://t.co/tYi1HT393b
 
@ircmaxell Like?
 
There is just way too much brain-fuck involved here to write it at this time...
 
user895378
@NikiC Caveat: "... is never the wrong answer" ... UNLESS there's a feature-freeze looming.
 
unless:
- Ohg oh I'm dying please help cough ough
- I'm tired and don't want to think about that right now
 
11:24 PM
@PeeHaa people here have said it. It just took symfony pointing out the use-case to realize that it was wode-spread
 
Now why do I think people here means @Ocramius? :P
 
I may whip up a patch tomorrow
 
Why do people prefer Stackoverflow chat vs Freenode##php?
 
Because it sucks less
 
@TheodoreR.Smith This is a more opinionated chat room. It's not the right thing for everyone.
 
11:28 PM
it's really less of a ##php and more of a #phpmentoring or #phpc
 
Holy cow. That moment you stop working and you realize it is actually friday \o/
 
that moment you look up and it's 18:30
 
@PeeHaa as long as you don0t trick us into watching a certain video…
 
user895378
yeah that.
 
@NikiC Well, I think I can get it all from the current stack frame...
 
11:29 PM
@ircmaxell :)
 
@PeeHaa It's not Friday by the "day starts at 6am" definition
 
@bwoebi I would never betray you!
 
@NikiC what about the "whenever you wake up after going to sleep"
 
@ircmaxell The 6am rule is a discrete approximation of that. Because I virtually never stay up til 6am and certainly never wake up before that :P
 
hehehe
unless you go to a conference in the US with Lonnie, at which point you simply won't sleep for 3 days (so does that mean it's always the same day?)
 
11:33 PM
@ircmaxell I think if the day is already 72 hours long we can no longer in good conscience consider it to be a single day
 
Ah, all these rules
 
@NikiC Doesn't that depend on the planet you are?
 
@PeeHaa Ah yes, that is indeed a valid concern
 
@Leigh Sorry for taking a while on random. Lots to learn. :) I don't want to hold things up! I'll push another commit today and if it's not up-to-snuff you can totes just take over if you like. Just trying to get involved more but don't want to at the expense of getting random added ASAP. :)
 
Ok, since we've obviously gone ad-absurdism here, I'm off. Later all
 
11:34 PM
@NikiC a few questions about yield* … Are you going to pass the yields directly through to the calling generator in case we have multiple levels of yield * or are you going to loop on each level over the yields (slow)? Also, we're going to have proper stack traces that way? (each generator level counting as one frame)
 
later @ircmaxell
 
We may also run into issues with people using polyphasic sleep schedules
 
ROTFL: Laravel, the new Static site generator
 
@ircmaxell later
 
@ircmaxell where did you that from? :o
 
11:35 PM
@SammyK It's OK man, but with feature freeze looming, RFC discussion and vote is going to be min 2 weeks
 
@bwoebi saw it on IRC...
 
but I realised, we can just RFC whenever, because the implementation is kind of trivial, we can implement whatever was voted on afterwards
 
Yeah, that's what I figured. I've never been involved with the RFC process so not sure where to start on that one. :)
 
anyway, latz
 
Maybe we can use some bits from: github.com/SammyK/php-src-csprng
 
11:36 PM
@SammyK OK, how about tomorrow, I draft it and forward it on for you to tweak? Do you have RFC karma on the wiki?
 
@bwoebi I'm currently targeting a stack'd implementation that directly passes through. Stack traces may be a problem though.
 
I don't think I have karma yet, but I requested it for my test contribution: github.com/php/php-src/pull/684 but didn't hear anything back :)
 
@NikiC because in async world, it's very annoying because you never really get where functions were called from… would be nice to have a nice stack trace here…
 
@SammyK You need a wiki account, and request RFC karma specifically. No biggie, I'll draft it anyway as a gist and we can do it that way
anyway, it's that time of night again ;) night
 
Cool - I have a wiki account. Who do I need to hit up about karma?
 
11:39 PM
@bwoebi Yeah I can see how it would be nice, but not sure if possible
 
I'll try to post in the IRC channel where the internals peeps hang out. Night! :)
 
If it's just adjusting a few prev_execute_data pointers it's okay, but it may also require more complex handling in which case it's probably not worth it
 
@NikiC oh, it definitely is possible… question is only how much you have to change for it in the engine…
 
@ircmaxell UKIP is one of the best know exports by Koch brothers
 
@NikiC afaik, stack traces are only looping prev_execute_data. You just have to make attention to not mess these up...
 
user895378
11:42 PM
@bwoebi lol, this is kind of true of all software isn't it?
 
user895378
"Yes, it's totally possible. But it might cost you an arm, a leg, an oxford comma and a firstborn child to make it happen."
 
@rdlowrey Where the oxford comma is the most valuable thing in that list, right?
 
user895378
Most likely.
 
@SammyK try reaching Tyrael, he added karma to my account in just a few minutes after the request.
 
Cool - thanks @marcio!
 

« first day (1587 days earlier)      last day (3374 days later) »