« first day (1501 days earlier)      last day (3447 days later) » 

3:03 PM
posted on November 25, 2014 by kbironneau

/* by venomtm */

 
@bwoebi Or at method call time (I much prefer this to when the actual return happens)
 
@DaveRandom awesome, thanks
 
@LeviMorrison yup, fine too as said.
 
I skimmed; I only noticed you say "instantiation time" or when you return ^^
Of those three runtime options, which would you prefer?
 
I fucking hate fixing frontend
 
3:16 PM
@JoeWatkins well, that wouldn't actually solve the problem we're talking about
 
@tereško s/fixing//
 
no
 
Someone told me here how to list all devices in a network with a command
But I forgot it -_-'
 
@Duikboot ping 255.255.255.255 … that?
 
It was: ~nmap -sP 192.168.1.1/24 :)
 
@DanLugg I like making frontend code, but I hate fixing crap written by frontend "developers"
 
@tereško A backend dev should be able to have well-structured html, then designers can just write the css without touching the html.
 
LOL
good luck with that one
 
3:38 PM
who? I?
 
lol
@bwoebi did you ever work in a team?
 
@bwoebi designers do not do css/js
 
@JoeWatkins That was my original idea as well.
 
@tereško rthen name it frontend dev…
 
I made a mega-comment on reddit about reserved words ^^ reddit.com/r/PHP/comments/2nd1sm/…
 
3:39 PM
Also note that whether we do invariant or covariant return types, I am beginning to think we have to do it at runtime and not at definition time.
 
@bwoebi Can I come to your perfect world? It sounds bright and sunny.
 
@AndreaFaulds that's not a mega-comment. It's a large-comment at best :-P
but nice writeup
 
@ircmaxell :p
@ircmaxell Thanks :)
 
@FlorianMargaine well, not in a team where the roles were clearly separated in backend dev/frontend dev...
 
3:44 PM
@ircmaxell MVC! MVC! MVC! MVC!
 
hi
it's another great day to learn some php!
 
@ircmaxell This is the first time I've seen this usage: github.com/ajaxtown/eaglehorn_framework/blob/master/src/…
 
@ircmaxell shortcut for using $this instead of $this->db
 
@LeviMorrison yeah, never seen that before (and hope to never again)
 
3:46 PM
Mornings
 
Even if it does what I think it does, they've used it incorrectly (passwd vs password).
If it doesn't do what I think it does then I have absolutely no idea what it does.
 
lol
 
ThW
@LeviMorrison and array key vs variable name
 
Dear all,
I am pretty sure return type variance can't happen at definition time. I am very sad about this.
 
@LeviMorrison what's the issue with passwd for password?
 
3:49 PM
ircmaxell why do you hate MVC so much
 
@LeviMorrison IMHO, it must. Otherwise you wind up in a situation where definition related errors happen at runtime (which means they may or may never happen), which means that errors in one part of the program can be triggered by unrelated parts (though the message is correct, it may be completely unclear why)
 
@bwoebi They've annotated "passwd" but used "password" in the code.
 
@LeviMorrison oh
 
@NewToMS have you read any of my blog posts on the subject?
 
You know what? I kinda wanna make a video about "how PHP compiles your code".
 
3:50 PM
yes
 
@AndreaFaulds pedantically, won't my talk from PHPNW cover that?
 
ThW
@LeviMorrison PHPStorm generates lines like that if you update a phpdoc comment and the @param definition finds no actual parameter
 
Here is a truly horrible example of class definitions that PHP really does support, inspired by Bob:
<?php

$bool = time() % 2;
if ($bool) {
    class A {
        function foo(): array {}
    }
} else {
    class A {
        function foo(): callable {}
    }
}

if ($bool) {
    class B extends A {
        function foo(): array {}
    }
} else {
    class B extends A {
        function foo(): callable {}
    }
}
 
@ircmaxell Hmm...
 
The variance of return types cannot be done at compile time.
 
3:51 PM
class definition time
in that case, opcodes are emitted for the class definition
 
@ircmaxell Probably, but I'll need to look at the slides again :p
 
What does the ":" after the function stand for? return type?
 
@ziGi yes
 
so the correct time to do the check would be when the class is defined (which happens at runtime in that case)
 
since?
 
3:52 PM
@LeviMorrison PHP's conditional definitions are a good thing though
 
but to be pedantic, you wouldn't do a check in that case since the strings match, no variance occurs
 
@ziGi Not yet in PHP, but may be soon.
 
yeah
 
@ircmaxell I've already implemented that, yes.
 
@AndreaFaulds you really want me to kick you from the room, don't you
 
3:53 PM
just found the RFC
 
@ircmaxell No seriously, they are. They allow you to polyfill.
 
@ircmaxell Without conditional includes you can't autoload really. Did you think of that?
 
@LeviMorrison condition includes are fine. Conditional definitions are not
use cases are few and far between where it's sensible to do conditional definitions
 
can someone explain to me why is function type hinting required, since this is going to bring things to language level
 
I am going to send an email out today (most likely) about return type variance.
The options are:
 
3:56 PM
 
@ircmaxell Conditional definitions and conditional includes aren't really any different
 
@AndreaFaulds yes they are
 
1) Do definition time covariance checking. This may (and probably will) require you to autoload your classes.
2) Do runtime covariance checking. This may still require you to autoload, but less often than 1.
3) Do definition time invariance only.
 
@ircmaxell And conditional includes are complete overkill for some things, especially constants
@ircmaxell How are they different?
 
@AndreaFaulds we're talking about fuzzy areas. And we're specifically talking about conditional definition of classes and functions
 
3:58 PM
@ircmaxell maybe, but from an engine standpoint of view no reason why there should be made a difference in functionality.
 
@bwoebi yes there is
 
@ircmaxell Alright, but still.
 
no, not "but still"
there are huge differences
there's a lot of work that goes into compiling a class and a function
 
@ircmaxell less brevity please ;-)
 
if you conditionally include, you can cache all that work
if you conditionally define, you can't
 
Adz
3:59 PM
Hey guys, I'm passing a paramter from php to my template using 'size'=> $sideSize , from my html side I'm trying to use the 'size' in a for loop i.e. {% for i in {{size[0]}..0 %} However, I get an error. Any help plz <3? I'm trying to get the value of size from my php file
 
in fact, if opcache were inteligently designed, an include of a file that only contains a class or a function (or multiple) should effectively be a no-op
doing extremely little work
but with conditional defines, you need to do a lot of work at runtime, every time
 
@ircmaxell opcache theoretically could also be able to cache partial files.
 
@bwoebi not without changing how the engine works
 
@ircmaxell it'd just need an user-defined opcode there.
 
What is the proper reason for which overloading in PHP is not done by implementing multiple methods with the same name but instead having conditional statements in a single function checking the type and count of arguments?
 
4:00 PM
@ircmaxell Ah, that's a fair point. So, I should use eval then?
 
the end effect of if ($foo) require 'bar.php'; and if ($foo) class foo {} are practically the same. But the paths they both take, and what happens behind the scenes are quite different.
 
which afaik is possible, there just wasn't any use for it before @ircmaxell
 
@AndreaFaulds no, because you're doing the same work
/me quits conversation
seriously
 
@ircmaxell That was my only troll response in the entire thing
But you could actually use eval() to avoid using include if you were crazy or something.
 
@AndreaFaulds it was inappropriate...
 
4:02 PM
I mean, include is just glorified eval().
 
no, it's not
 
@ircmaxell How not?
 
@bwoebi actually, my quitting was more due to your statement of "there just wasn't any use for it before"
 
@ircmaxell I mean for user-defined opcodes.
 
Or rather, eval is just glorified include
 
4:03 PM
Hey guys. Out from surgery now. All seems well, bit of an ache but all good.
 
but with those you could load in partial files.
 
really, am I really arguing with people who have commit access to internals about how eval() is not the same as include, especially in the contexts of conditional definitions and conditional includes???
 
Both do essentially the same thing.
 
@Fabor that's great to hear!
 
4:03 PM
OK, they're very similar then.
 
no
the end effect is similar
 
@Fabor wut! what did you do
 
but the in-between parts are completely different
 
What's the primary difference? (sorry for having to ask...)
 
Adz
Can someone who uses Twig try and help me with my previous question please?
 
4:05 PM
@AndreaFaulds let me ask this: what have we spent the past 10 minutes talking about?
 
@ircmaxell Conditional includes vs declarations?
 
and
 
@FlorianMargaine had stress fractures from basketball that wouldn't heal. So they put a nail down my entire shin.
 
their effect on...
 
performance, as one means compiling both, the other only compiling the other
 
4:06 PM
@Fabor already back =] everything ok?
 
no... not performance, more specific
 
@Fabor I knew exercise was bad for you. Congrats on becoming part metal I guess?
 
@ircmaxell opcache?
 
yes
 
@Fabor ah! trying to imitate wolverine?
 
4:08 PM
Well, I suppose eval doesn't work with opcache, yeah :p
 
@Adz put the code in a pastebin/pastie and also the error.
 
if ($foo) eval(...), if ($foo) include ... and if ($foo) class {...} all are different when it comes to what can be cached, and what can't be (what must happen at runtime)
 
Ah, right, I get you.
Today I learned that eval is actually the same opcode as include, actually, as I read the source. And that include doesn't affect include_once.
 
include doesn't affect include_once...? what do you mean?
 
include_once updates included_files, include doesn't appear to, so doing an include then an include_once should include a file twice. Except... it doesn't. Hmm.
Ah, compile_filename does that for include.
 
Adz
4:12 PM
hey @RonniSkansing pastebin.com/rt0XS7TR
 
include does affect include_once, but if you didn't know what compile_filename did, you might be forgiven for thinking it didn't ^^
 
Adz
never mind, I had to use parentheses
thanks
 
I am starting to think that the ONLY difference between a 10x dev and a 1x dev is that the 10x dev doesn't read HN and Reddit.
@AndreaFaulds it's all good. It would be bad if it didn't :-P
 
@Adz no problem [=
 
@ircmaxell why wouldn't it ?
maybe I misunderstood the idea ...
 
4:20 PM
@ircmaxell what is "10x dev" ?
 
@JoeWatkins huh?
@tereško a mythical thing
 
well, I know that there are "black matter devs"
 
yeah, I didn't get past the router for that one
 
so the thing I thought you were describing was an additional opcode to check variance, if all variance is checked at runtime by that opcode, doesn't that solve the current problem ?
 
4:23 PM
@JoeWatkins where is that opcode put?
 
@ircmaxell for fuck sake
 
not sure, I think putting the checks in ZEND_FETCH_CLASS is sane enough, either that or an additional opcode emitted just after FETCH_CLASS ?
 
this was the thing I didn't get in the first place ... how it would actually work ...
 
4:26 PM
@JoeWatkins which fetch_class?
 
no, not what I mean
isn't that opcode used anytime a class is needed?
 
everything uses fetch_class to turn a name into a class entry, so that should be the earliest opportunity to do these checks and know that everything is available, I think ?
 
too late IMHO
I would do it right after DECLARE_INHERITED_CLASS
 
yeah, but we could set something in ce_flags to skip/perform check ...
yeah or that
 
4:28 PM
Is: Load time 1.09s a long load time for a website?
 
Rough draft to Internals about options for checking return type variance: gist.github.com/morrisonlevi/34b7ce764c16553f13ed. Any feedback on the message before I send it? Advantages or disadvantages I haven't mentioned?
 
Hi all
 
since IMHO any errors after the class is available is too late
 
@tereško It's from a study which supposedly shows a 10 times productivity difference between individual programmers.
 
@Duikboot yes
 
4:29 PM
@Danack I know that myth , but it's bullshit
 
@ircmaxell yeah the bind one is better ...
 
@LeviMorrison "but not reliably because of conditionally defined classes" <-- I think that's a separate problem, and should be discussed as such
 
it's not normally necessary
 
@ircmaxell There's no point in mucking up the internals to support same-file definitions in this case when it can't be done reliably. In my opinion it's not separate enough.
 
@Danack the orders of magnitude apply only when you have to fix code made by somebody else
 
4:30 PM
Point-blank, option 1 will require autoloading in some cases.
 
@LeviMorrison "and won't be discovered until the code is ran." <-- not discovered until that particular method is called. HUGE difference, as it may never be called, hence you have a declaration error that's never found.
 
@tereško I know i) It's repeated by head-hunters who claim to be able to find 10x devs ii) I've known programmers who had net negative productivity....so doing a straight multiple isn't a useful comparison.
 
@ircmaxell Not necessarily; we could do checks when class is instantiated.
But again, if class isn't used it isn't caught.
 
eih
 
I could be a bit more verbose there, though.
 
4:32 PM
@Danack I'd rather have a dev that can multiply those around them, than one that's a multiple of those around them.
 
@ircmaxell++
oh look, I can talk
 
o wow
hi @ElizabethMSmith
 
HEY!
 
@ElizabethMSmith Gratz :)
 
/me waves
 
4:33 PM
o/
 
:-)
 
this is slowly becoming the alternative internals chat
 
it happened quite quickly ...
 
slowly?
 
alternative?
:)
 
4:34 PM
it has been for years, the non-internals people just haven't noticed until now
 
I'm just happy that this chat room has not devolved
 
wtf is a 10x dev ?
sounds like marketing ...
 
to be fair, we also sometimes discuss non-internals things here...
 
a dev that's 10x more productive than the ones around them
 
yes, kittens and such are always on the menu ...
 
4:35 PM
6 mins ago, by Danack
@tereško It's from a study which supposedly shows a 10 times productivity difference between individual programmers.
 
I see I see ...
Never look for a "10x dev", even if they exist. Look for a dev who can multiply those around them. That's true power.
 
also I (for example) tend to be producing code slower then others .. because half of day I spend dealing with issues of other co-workers .. or fretting over "variabale and function names"
 
Building software with average developers exposes two project myths: 1)that you can shorten a project by adding people and, 2) that its OK to have average developers produce average (buggy/off-task) code at an average pace. In truth, average developers drag overall productivity down and the project takes longer than necessary to complete.
The solution? Give good developers powerful tools. You'll get higher quality software faster. Second, having warm bodies doesn't help projects, and having to baby-sit poor developers cuts the productivity of your good developers, who are craftsmen. Softwar
I agree on "warm bodies" and that adding people will shorten a project. But I disagree on the rest.
@tereško do you thereby increase the rate that the co-workers produce acceptable code?
 
4:37 PM
"acceptable code" ?
 
@tereško meaning not just commits, but commits that are useful, and you know what I mean
 
your expectation are way too high
 
@tereško then call it not-so-horrible code
 
all I can manage to do is try to prevent complete disasters
 
You know, 10x devs do exist but it tends to involve alcohol
 
4:39 PM
@tereško you do prevent more disasters by dealing with coworkers than if you spent all your time coding?
 
well ... I'm probably closer to a 10x dev that the ideal developer then ...
 
I think the 10x dev is a myth. Every one I've seen is more productive for themself, but brings down the entire team
 
I'm okay with that, I have very little patience ... I can be more productive on my own than I can trying to carry a bunch of people ...
 
@JoeWatkins and that's something I hope to change (both that you believe you're more productive on your own, and that you think it's about carrying other people)
 
we don't really have teams here
=/
 
4:41 PM
@ircmaxell I've never really had anyone to work with ...
 
A bad team reinforces those feelings. An average one is hit or miss, but a good one will make you realize that's holding you back
man, it's times like this I wish I was running a team again
 
I'm stealing and mangling a line from coderabbi - you need a mentor and a colleague to improve yourself
 
++
I'd amend that: you need a mentor, a mentee and a colleague.
 
Draft 2 for Internals message about return types: gist.github.com/morrisonlevi/34b7ce764c16553f13ed
 
I have people I work with that understand the stuff I'm doing, but none that can be actually useful, genuinely, if I try to get anyone else more involved, I will just be wasting their time ... similarly if I drop what I'm doing to work on boring shit, I'll be wasting mine ...
 
4:44 PM
@LeviMorrison looks better
 
everything in an ecosystem doesn't need to work directly together in order for that ecosystem to thrive, all of the species on the planet depend on algae floating on the surface of the waters ... I'm like that, shoring up the economy without being involved with any of the other species ...
 
ping @rdlowrey
 
user895378
Just sat down five seconds ago. Good timing.
 
@JoeWatkins if you can't find one at work, that's what an open source coding body is for
 
user895378
@DaveRandom What's up.
 
4:46 PM
wait, did I just say I was like algae ... I'm not like algae ...
 
@JoeWatkins have you read this post? blog.ircmaxell.com/2013/07/why-we-do-what-we-do.html
@JoeWatkins like an onion?
 
@rdlowrey So... feeling a bit indecisive over how approach something. Imagine you have an SQL result set sitting on the wire in a highly async env. Would you want to fetch all the available results in one shot or get them one at a time and hand control back to the reactor between each one?
 
oh yeah opensource stuff is totally different, I enjoy it because people say stuff I don't understand, I get to work with you fine people, I thought we were just talking about work life @ElizabethMSmith
@ircmaxell reading ...
 
user895378
@DaveRandom I prefer an Iterator that returns a Promise for each result (may already be resolved) and when there are no more results then Iterator::valid() returns false. This lets me do things like:
 
user895378
foreach ($results as $resultPromise) {
    $dbRow = (yield $resultPromise);
}
 
4:50 PM
@rdlowrey Issue is more that this routine will actually block while there are still results on the wire
Control will never be handed back to the underlying event loop in this scenario
Actually wait.
I may have been looking at this the wrong way
hmmm
 
@ircmaxell yes
 
:-)
 
@ircmaxell Ah, it can't be done on first new.
 
no?
 
Static methods still need to be checked.
^^
 
4:54 PM
well,
you could do it on new or method call, whichever is first
 
Possible but I'd rather just keep it simple and do it on first method invocation.
 
first method invocation, ok
 
@rdlowrey yeh I'm confusing myself because I'm testing this in a place where there's nothing else going, so I'm just seeing a sequence of blocking calls, because that's effectively what it is, I'm forgetting that there's idling time in between the calls where other stuff can happen
Also, it sounds like you might want buffered query modes by default (in which case you only get one iterable thing after the whole result set is received)
 
@ircmaxell OK, High-Performance PHP does cover how PHP compiles and executes your code... in 3 slides. Hmm... maybe there is room for something much longer, then? :p
 
:-)
 
4:57 PM
I'm not sure how to make this work sanely with promises
 
user895378
@DaveRandom Well the nice thing about splitting each result in the result set out into promises is your API doesn't change whether you've buffered the results or not.
 
user895378
@DaveRandom Well the yield scenario I demonstrated above is how it would be done with the amp stuff ... you need a co-routine for the yield things to work automagically.
 
I'm not sure how to signal via promises that e.g. that was the end of a result set but there are more result sets
 
@ircmaxell Ah, Option 3 is not accurate.
 

« first day (1501 days earlier)      last day (3447 days later) »