« first day (1277 days earlier)      last day (3671 days later) » 

7:00 PM
@ircmaxell those people are not a problem in JS until they start spreading FUD on popular questions - there is a big community people who understand UI better in JS today, but the problem is a lot of new comers really don't bother thinking about their problems and shove frameworks at them immediately.
 
@BenjaminGruenbaum Oh, don't get me wrong, I'm not saying that as an insult in the least. Just that it creates its own unique set of challenges...
 
@ircmaxell They said to me, nobody ever decodes JSON as object ^^
 
@ircmaxell PHP typing is funny to begin with, I hope the next version fixes your half type system half not. (meaning scalars)
@ircmaxell why would I be insulted?
I also really hope C# fixes their type system. If I could get C# but with optional structural typing and much stronger type inference that'd be really awesome.
 
@BenjaminGruenbaum just wanted to be clear. I didn't expect you to be insulted (as I don't count you in that group), more saying that I wasn't trying to insult that group I was talking about...
 
@ircmaxell ah, for the record - I don't think the average developer coding in JS is any better or worse than the average developer coding in PHP.
 
7:03 PM
@TOOTSKI nobody ever uses objects: 3v4l.org/rYEIK
@BenjaminGruenbaum that's a bold statement
 
@ircmaxell it is?
 
:-P
 
I think so. In my area there are far more intro level JS programmers than intro PHP programmers; if that holds true elsewhere then you made a bold statement.
 
@BenjaminGruenbaum guess that depends on if you take client side JS into account
 
7:09 PM
@ircmaxell Figured, that's why I asked you in the comment the other day, didn't know there were several "ways" to make an object.
 
Well, every single php developer is absurdly bad (except for a few people, you know who you are).
 
@TOOTSKI yeah, that 0 is basically unaccessable without reflection (actually, not even sure if it's accessable with reflection, second)
 
:P
@Machiel people write horrible horrible code in Node.
 
@BenjaminGruenbaum No doubt, you can write crappy code in any language, but it's already harder to get started with Node than just copy-pasting away a JS file and refresh your HTML page.
 
They don't understand fundamental issues that programming has that platforms like PHP abstract from you. Resource management, exception handling, stability concerns. How to restart parts of your server gracefully while maintaining others, and the HTTP protocol.
 
7:12 PM
@BenjaminGruenbaum They are just bad programmers, regardless of the language.
 
Interesting, you can't reflect over dynamic objects? 3v4l.org/LrL1t
 
@TOOTSKI you know, the common NodeJS approach is when an error occurs - restart the server - that's absurd.
 
@ircmaxell Yes, as the reflection bits look at the class definition, not the actual object. Same thing happens if you add a property at runtime (though IMO that's broken behavior in most common cases...)
 
@ircmaxell That's what I'm talking about, no one knows how that stuff works ^^
 
Writing applications that run for days while serving 10K people at a time and performing background maintenance, making it possible to edit them while they run, and bring up and down code pieces without causing resource corruption, memory leaks or security holes is crazy hard.
 
7:14 PM
@Charles I would expect ReflectionObject to decorate the class's data with the object's hash tables
@BenjaminGruenbaum HUH?
 
Not that that's different from building a big PHP app.
 
@BenjaminGruenbaum well, but PHP is designed for that purpose (being shared nothing, means you can kill it at any time with no illeffect)
 
@ircmaxell yes. If a fs.readFile failed what most programmers would do is throw it, let onUnhandledException catch it, and restart the whole server.
 
@BenjaminGruenbaum that's just painful... At least have a global try/catch in the event loop to kill the one worker, but gracefully recover
 
@ircmaxell you can write shared nothing in Node, that's just a bad design in general.
 
7:15 PM
Sort of when they turn off error_reporting(0); :)
 
@ircmaxell Yes, but that would be the sane and correct approach, and we're talking about the PHP OO innards here.
 
@BenjaminGruenbaum I don't think it's bad design at all
@Charles :-D
 
@ircmaxell or don't kill it at all and handle the exception? Retry serving the file, if you fail serve a 500 (or 404 or whatever is appropriate) and carry on.
 
@BenjaminGruenbaum No, definitely handle the exception if you can. But at worst just kill that one request, not the whole freaking server
 
Maybe I did not explain it correctly, if at any point you have any exception in your application, you usually terminate the whole application and restart it. I don't do that, but it's what a lot of people do in the Node world.
 
7:17 PM
yesterday, by Charles
@JoeWatkins, uopz... You are beautiful and amazing and horrible.
That's PHP :D
 
No seriously I wish you hadn't quit trying to contribute, 'cause I would kill for runtime application of traits to instances and I don't have enough C-fu nor internals-fu to know where to begin.
@TOOTSKI No, hold on, there's a better quote for PHP...
 
@ircmaxell in Node?
 
@Charles runtime application of traits is going to be basically impossible without a significant refactor of the engine
 
The problem is that most people learning node think Node will instantly solve their scaling problems.
 
@ircmaxell Oh good, I like it when the impossible is needed.
 
7:18 PM
@ircmaxell no it isn't, it is done ...
 
@JoeWatkins wait, what now?
last I looked, there were significant issues specifically around how CE's are used and cached around the engine
 
uopz can do that already
 
:popcorn:
 
@JoeWatkins Trait application of instances, not classes?
 
oh oh, I misread
yeah no instances
 
7:19 PM
Yeah.
 
Boooo.
 
although I wrote the code to do that too
 
:D
 
@JoeWatkins yeah, I want $foo = new Foo with BarTrait ()
 
that does runtime multiple inheritance ...
probably not sound, but I don't think impossible ... and I don't think refactor...
oh yeah, well language support for it would require an rfc and a big fight, and I'm never up for that ... but we can do it externally whatever ...
 
7:22 PM
There, found it...
> PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.
4
 
@JoeWatkins you're just creating a new CE, and inserting it as the parent, with the parent re-bound, right?
 
I hate that quote ...
I actually don't remember, if that's what it looks like, then yeah :D
 
@Charles LOL ... never seen it before.
 
Being a (mostly former) Perl guy, I agree with the quote entirely.
 
@JoeWatkins well, that was your work, so I'm asking youā€¦
 
7:23 PM
@bwoebi then I misunderstood the question ...
> new Foo with BarTrait ()
 
Basically, to do that, you'd need to create an anonymous CE, add the trait, and set the parent to the actual class... And do all of the compile checks, renaming and appropriate parenting.
 
I like this ... I never seen that before ... where's it from ?
 
@JoeWatkins scala, and the original trait paper
 
...list doesn't work on maps, just arrays? I figured it would just access them in order...
 
silly, there's no point in me writing a patch ... but I like that, and there's no way to have it without fighting with internals ...
 
7:28 PM
sigh
this is why we can't have nice things
@JoeWatkins unless you add a Zend hook to allow for compiler constructs... ;-)
 
I tried to get niki an felipe to think about that in the context of the current compiler and the proposed ast one, they both said really hard with ast and probably impossible with current compiler ... do you see a way ?? point at it ...
 
Extend the debugger, push that syntax in, don't tell anyone and hten tell them it just happens to work with your patch :P
 
syntax changes require changes to the parser and lexer usually, so I can't do anything outside of /Zend to introduce syntax, if I could, I would have never bothered with rfc's tbh @BenjaminGruenbaum
 
@JoeWatkins why really hard with AST? I'm not talking about adding new tokens... A pre-compile on an invalid AST to turn it to a valid AST would work and not be hard (as long as the lex and parse phases were sufficiently separated
 
yeah that seems sound ... current compiler ?? anything ??
 
7:33 PM
nothing really :-)
 
crappy ... it would be so awesome to be able to put language changes out there for users regardless of what internals are doing, or not doing, or pretending to do ...
it is why we can't have nice things, but I don't actually know that it's bad ... if we accepted every patch anyone wrote, we would have everything .... because I've had a lot of free time lately ... and I can't say that'd be good ... I have no idea how to manage it better than it is being managed, much as I dislike that we can't have nice things ...
 
that's why I think we need to take a step back and start refactoring
I started playing around with pulling GTest into PHP...
write the unit tests in C++...
 
Things I'd like to see in PHP 6: engine refactor.
 
@JoeWatkins I think this is why 'hack' was born :P
 
By refactor I don't even necessarily mean convert to AST.
 
7:38 PM
yeah was just looking ... that does look interesting ... I had only just heard of xunit because seb mentioned it in a reply to a tweet .... I've never looked at the idea of unit tested c, it has just never occurred to me ...
 
@LeviMorrison why. what's the goal of the refactor
 
I mean: clean it up.
It's horrible.
 
@LeviMorrison specifically. Because you're talking about 1) a lot of work 2) bc breaks for PECL)
and they need justification
 
@BenjaminGruenbaum pretty short sighted solution imo; if they are successful in what they are trying to do, they will end up in the exact same position internals are in now ...
 
@JoeWatkins no, they'll probably use a BDFL approach.
 
7:39 PM
@ircmaxell Justification: it's horrible.
 
@LeviMorrison what would the benefit of the refactor be. To justify the pain it will cause...?
 
To make it easier for further maintenance and improvement.
 
obligatory "things you should never do" link
 
@LeviMorrison that's vague. Can you think of very specific examples?
 
Yeah. Find me any file with a macro. Probably is horrible.
 
7:41 PM
@LeviMorrison You know what I mean.
 
Yes, and I think you know what I mean too.
 
@LeviMorrison I do, I'm thinking of having to justify it to people, and am trying to work through the excersize of creating tangible examples of what features we want to enable / make easier
 
@ircmaxell what's the function with the highest mcc in php-src
 
because as is, an unguided and unbounded refactor will simply fail. With a targetted reason, and specific goals, it can succeed...
 
@BenjaminGruenbaum that does not work, that is what internals are meant to be to the rest of the community ... from within the hhvm team they will have to face the exact same problems we do, bdfl or not ...
 
7:43 PM
github.com/php/php-src/blob/master/Zend/zend.c#L134 this is the first file I opened and that looks quite horrible already :D
 
@BenjaminGruenbaum you are looking at normal C code, this is the vm ... github.com/php/php-src/blob/master/Zend/zend_vm_def.h
 
Lol, that file gets worse, and those are just functions that print stuff.
 
there's nothing whatsoever wrong with that ... nothing ...
 
@JoeWatkins is that a file that's 5670 lines long?
 
@ircmaxell This is a really good idea, by the way.
 
7:45 PM
@JoeWatkins Maybe you sent me the wrong file? Or is this the post-build result of something?
 
@BenjaminGruenbaum think compiler optimizations ...
 
It's a compiler optimization to have one file that's over 5000 lines long?
 
believe so
also, whats wrong with a big file ?
 
wow, that file is just wow.
Especially after browsing through some Roslyn code and some V8 code today... this code is just... wow.
 
agree
 
7:47 PM
what's wow ?
I don't get it ...
 
Look at the Roslyn C# compiler source code, read it.
I'm not even talking v8, which is also a great code base, but let's disregard that, that's c++ and you dislike C++ for whatever reason.
 
isn't this C# ?
 
You've got to be kidding me, there has to be a version of that zend_vm_def file with documentation, and multiple files. That file has to be the end result of some build process.
@JoeWatkins the C# compiler is written in C#, yes.
 
@BenjaminGruenbaum nope
 
apples and organes
you do not open a c source file and expect to see organization you see at high levels, not achievable
 
7:50 PM
@BenjaminGruenbaum it's the input of a build process
 
@ircmaxell I'm speechless.
 
haha
 
Is that file really over a megabyte long?
 
> (Sorry about that, but we can't show files that are this big right now.)
 
7:51 PM
@BenjaminGruenbaum yup, it's massive.
 
@ircmaxell that's something you build from :O?
 
@BenjaminGruenbaum ;-)
 
You have a file
That's 45K lines long
In php-src ?
 
@BenjaminGruenbaum it's generated from zend_vm_def.h
 
You know it is going to be a good one when it starts out like this:
 
7:53 PM
@ircmaxell Phew.
 
static user_opcode_handler_t zend_user_opcode_handlers[256] = {
    (user_opcode_handler_t)NULL,
    (user_opcode_handler_t)NULL,
    // x254
}
 
I've done quite some C/C++, but opening files like these seriously scare me to death. I do want to contribute though.
 
php is one of the easiest projects I know of to work with that is written in only C ...
 
@JoeWatkins I'll actually second that. I tried looking at openssl, and holy mother of god
 
7:54 PM
There is very little you can say at this point that will convince me that is a good code base @JoeWatkins :/
 
I don't see what all the fuss is about ... the level of organization is realistically comparable to that found in linux source tree, that's acceptable ...
 
@JoeWatkins LOL
 
@JoeWatkins I'm talking about breakpointā€¦ which you refactored some time agoā€¦ I'm seeing a lot of > list when something's hit, but there's no phpdbg> prompt. Shall we completly remove the >list or put a prompt thereā€¦ after quit is used.
 
I admit the lexer in Roslyn is rather huge too though.
source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.CSharp/… one of the hottest pieces of code and the least organized in Roslyn, still a lot clearer.
 
IT IS C SHARP
you are comparing apples and oranges ...
you don't open a bash script and expect to see the organization of a comparable php script ...
don't be silly ...
 
7:57 PM
Being poorly organized isn't C's fault.
I dislike C a lot for missing some very fundamental facilities, but I've seen well organized C code too.
 
do you understand the code you are reading ?
 
Which one?
 
@BenjaminGruenbaum rofl
 
the vm one
 
I know we've been over it before, but I think we should convert to using a C++ compiler, then to modern C++. I can't cite any specifics but I can't imagine needing so many macros in C++.
 
7:58 PM
No, I do not. In Roslyn there are a few things in that code base that are really helpful - for example: comments.
That vm code is full of macros, and magic numbers. I can probably guess what some of it does.
 
well if I pick up a book about medicine and start reading the pages it would seem unorganized to me, I do understand it, categorically, there's nothing wrong with that file ... in general there's nothing actually wrong with the way zend is written, some people dislike macros or prefer c++, but don't actually provide any reasons for avoiding macros or putting an enormous amount fo work in to achieve either things ...
if you understand what you are reading, it makes sense, if you do not, it does not make sense, obviously ...
 
Can I be blunt?
 
yeah
 
You know I have a lot of respect for you, but that's one of the dumbest things you've ever written here.
Sorry.
 
@BenjaminGruenbaum magic numbers? In function declaration? no. these aren't magic numbers, but incrementing ids for the opcodeā€¦
 
8:01 PM
@bwoebi it goes from 11 to 14
Then back to 12 and 13.
Then the next one is a HELPER_EX that accepts a function pointer or macro - who knows.
 
@BenjaminGruenbaum well you haven't said why, you haven't said why its bad that you can see macros ... nobody ever really does ... macros aren't a problem if you know what they do ...
 
And is also huge, and has a single line of documentation with an exclamation mark.
 
say something that proves they are a problem if you know what they are doing, and I'll listen ...
 
@bwoebi ...now, I might be a little slow but isn't that a particularly magic number?
 
documentation is another thing ... I waiver back and forth, even volunteered to improve the state of it at one point ... loosing battle, once you understand enough of what you are reading the truth is you do not require documentation and would never use it ...
 
8:03 PM
The cognitive overhead they introduce is huge compared to function calls or templates that are a lot more predictable. You can understand code in any language, even in Cobol or direct assembly.
 
@JoeWatkins I don't think that's appropriate. You can't really say that Zend is well organized (in general).
 
Not to mention huge functions, it's a huge file, and it's full of pointers to pointers and very long lines.
 
@ircmaxell I think the bits that matter are, the rest is just normal c ...
open up any file in linux source tree ... it's completely comparable ...
 
I can totally understand "I don't think we should change that code base, that would be a lot of work"
Or "It is not a priority to change that code base right now"
 
@JoeWatkins when you need to search the files to figure out where something's defined, it's not organized well...
 
8:05 PM
I just don't understand why anyone would think it's anything short of bad.
 
that's normal for C ...
 
@LeviMorrison it's an unique random number. Not a well chosen magic number
 
@ircmaxell I spend more time doing that in PHP than anything else. And sometimes it has to be a specially crafted search :/
 
No, that's normal for that code base. I've worked with C code bases that were nothing like that.
 
So, @BenjaminGruenbaum one reason the VM is in one file, is that one of the strategies for implementing the VM is turning it into a giant switch statement. And another uses gotos. They aren't always (or even usually) isolated functions....
 
8:07 PM
@JoeWatkins Not to mention I don't understand why you'd like using C in 2014 for this in the first place. However, the argument of 'changing that would be very expensive and our time is better spent elsewhere' is very solid IMO.
 
@ircmaxell actually, I'm always confused with variables.c, operators.c, execute_API.cā€¦ I never know where it isā€¦
 
@BenjaminGruenbaum well its not only that, that's probably the only thing stopping someone trying ... but nobody has ever said what we would actually get out of it, the closest anyone has got to explaining what benefit that would provide is niki pointing out that refcounting (a cause of many bugs) would be basically taken care of ...
 
@ircmaxell There is nothing wrong with using gotos for a state machine there, it's not pretty but I can totally get why in a performance sensitive area you'd want that, I don't understand why that'd limit you to one file though.
Oh, wait, by not isolated functions you mean you jump from function to function with gotos :O?
@JoeWatkins RAII, clean code, namespaces, templates etc. C++ is as clean as modern PHP, imagine being able to code the PHP engine in PHP itself and it being fast enough. C++ is as close as you get to that today.
 
user895378
Definitely count me as pro goto when it comes to state machine parsing :)
 
@BenjaminGruenbaum have you looked at the hhvm source code ?
 
8:11 PM
But never goto out of a function's scope.
@JoeWatkins to be fair I haven't.
 
user895378
@BenjaminGruenbaum yup
 
Link me to similar code in hhvm?
 
@JoeWatkins my point
 
@rdlowrey although that'd be a setjmp and longjmp so not really a goto.
 
8:13 PM
@BenjaminGruenbaum they aren't actually isolated at all...
 
@BenjaminGruenbaum And probably longer build times ^^
 
so, this is C++, right, this is as clean as modern PHP right, written by people who know PHP inside out and C++ probably better ... so this is as good as it can be, right ??
 
@LeviMorrison only if you abuse templates too much.
@JoeWatkins that file does what the vm file does for standard php?
 
well, no, it's the compiler(.cpp)
;)
 
It does look a lot better though.
 
8:15 PM
...
 
Though, it's all compile options management :P
 
^^ (just being cheeky)
 
user895378
@JoeWatkins Do you have any guidance on building pthreads on windows? The --with-pthreads flag listed in the ./configure --help output seems to have no effect :/
 
@rdlowrey I do it when I'm embedding in HTML (template stuff)
 
I totally disagree ... I don't find it any more organized, moreover I fail to see where namespaces, templates, or C++ makes that code any better ...

https://github.com/facebook/hhvm/blob/master/hphp/runtime/vm/bytecode.cpp

this is more executor kind of stuff and is worse than anything you will find in php, in that single file you can find reference to apc, the executor, engine functionality (lookiup traits, get cv var) ... it's fucking terrible ... if this is what C++ would create, no thanks, not at all ...
@rdlowrey I don't do that anymore, ping weltling in php.pecl, he does it now and changed it ... if I told you anything it would be a guess ... sorry about that ...
 
user895378
8:24 PM
@JoeWatkins no problem, thanks :)
 
@JoeWatkins wut. 8k LoC without visible separation (like we have in zend_vm_def.h)
 
this idea that C++ will, by default, create a better language because it is a better language is just silly, regardless of whether or not it is a better language ...
 
8:42 PM
tl;dr: php-src is bad, but most other C code is much worse?
 
much ...
:( I have to suffix every response to a bug report with "sorry about the wait" ...
 
You need to make open less C projects at the same timeā€¦
pthreads mostly only got popular recently^^
 
but I like to share ...
 
eih
 
kinda thought I'd be getting help by now ...
 
8:48 PM
"If you use the arguments on the left to justify refactoring, you're screwed" - Martin Fowler via @mbohlende http://t.co/np4uQk1b95
oddly relevant
 
i.e. not worth it? :)
 
Well, no, not that it's not worth it. That you need to answer that question
 
@ircmaxell does the slide say that there's some economical reason for re-factoring ?
does re-factoring ever really include writing in another language ?? I don't think that's re factoring is it, even if the languages in question are C and C++ ...
 
@JoeWatkins if economics dictate that refactoring occurs (that it's too expensive to add new features, and refactoring will decrease that cost), etc...
 
how do we apply that here ?
 
8:52 PM
@JoeWatkins yes, refactoring can include writing components in another language. It could be moving a specific algorithm from PHP down to C
@JoeWatkins that's what I was trying to get at with my line of questioning to @LeviMorrison
 
well that's not the reason we can't add new features ... if only that were the reason .... we could do something about that ...
 
Refactoring IMHO must target a specific reason. There must be a concrete and measurable goal for it. Otherwise it's just spinning wheels
 
@JoeWatkins well, does it slow down, or make new features extremely difficult? Does it make them take an explosion of memory or CPU to execute?
 
8:54 PM
oh I see, I misunderstood context of expense ...
well the minute someone can show me tangible benefit, of course, I'm up for it ... but spinning wheels is right ...
 
@JoeWatkins right, if there's a definite goal, you can track progress and measure success. Not just "wing it"
 
I don't think it's difficult to add new features, I don't think we have a hard time controlling the economy of execution, there's only one thing that stops new features coming about and that's management, probably for the right reasons ... and say that there were, say that there were some economical reason to rewrite large sections of the engine in order to gain some short term benefit, the nature of the complexity of zend has not and will not change, therefore at some point the code will become
as unmanagable as the code you are rewriting ... I don't see what the end game is there, you appear to end up in the same position ...
 
If I didn't have so many demands on my time I'd really like to dig in and learn PHP source.
 
it would get to be more complex I suppose, so we might be able to do more advanced things easier, but you eventually hit the same wall don't you ?
 
Then, once I know it better I can try some of these refactors out.
But right now I would just break everything.
 

« first day (1277 days earlier)      last day (3671 days later) »