« first day (2028 days earlier)      last day (2920 days later) » 

Wes
9:00 AM
yeah, it's Traversable
 
Not sure if the engine could optimise this so that when an Iterator is unpacked it's delayed until it's accessed? So that if the first thing that happens is foreach you are working with the original iterator instance, otherwise it runs the full iterator on first access and converts it to an array?
/cc @bwoebi @NikiC ^
 
@DaveRandom you can unpack into something that's not variadic, and you can access a variadics arguments directly by index
 
Wes
@DaveRandom i thought variadics worked that way, eg Traversable unpack/pack would stay a Traversable, rather than be converted to an array
 
so I don't think that'd work
 
@PaulCrovella Yes but on index access it would convert it to an array
In fact, if you do anything whatsoever with it other than passing it to foreach it gets converted to an array
 
Wes
9:03 AM
that would be confusing, i think, no?
 
No, it would be transparent to the user
It's just an engine optimisation
 
Wes
could work...
 
specifically applied to variadic functions that are passed a splatted iterators
 
@DaveRandom leaving it as an iterator would also leave you open to mutation issues
 
Only if you are coding like a dumbass, but yes I suppose there are edge cases
 
Wes
9:06 AM
what would do is_array($variadic) ?
 
Convert it to an array and return true
literally any usage of the var (even $otherVar = $var) would cause it to be iterated
but in those cases, you haven't lost anything from what we have now
and in the case of a variadic function that just does foreach ($var as $whatever) at the top (which I imagine is the first thing that your addAll() currently does) it would prevent the double iteration
 
Wes
there's one thing, if you iterate over a variadic, then you make it get converted to array, not necessarily you get the same result.
 
Wes
generators for instance can't even be rewound.
 
@DaveRandom not only if you're coding like a dumbass, if you're yielding to the outside world prior to running over your $variadic.. who knows, it may still be stupid or it may make total sense for what you're doing
 
9:11 AM
@Wes You could populate it into an array during the iteration, so that at the end of the iteration it was just an array (but has only been iterated once)
Annoyingly I suspect you are right that it's not practical though
 
Wes
yeah but you end up collecting anyway, which is likely you want to avoid when using iterators / generators
 
Maybe it could work for methods where the entire function body is wrapped in foreach
but probably not
tl;dr just add a special-case method for it @Wes
:-P
 
We need something like linq
 
Wes
9:14 AM
i'm not adding special-case methods :B screw variadics
 
@DaveRandom I don't know if I'd want to see how php would fuck that up
 
0
Q: Angular Routing Pretty URL Error

Jishad PI am trying to make angular routing application. here is my code. <html ng-app="LumenApp"> <head> <title>LumanAngular v1.0</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <script src="js/jquery-1.12.3.min.js"></script> <script src="js/bootstrap.min.js"></script> <...

 
@SagarNaliyapara six doors down
 
3 Doors Down is an American rock band from Escatawpa, Mississippi that formed in 1996. The band originally consisted of Brad Arnold (vocals/drums), Todd Harrell (bass guitar), and Matt Roberts (guitar). They were soon joined by guitarist Chris Henderson, and later by drummer Richard Liles, who played for the band during their tour supporting their first album. Daniel Adair played drums on tour from 2002–2005. This configuration played nearly 1,000 shows across the world following the release of their hugely successful Away from the Sun album. In 2005, when Adair was hired full-time by Nickelback...
@PaulCrovella
 
Wes
@SagarNaliyapara chat.stackoverflow.com/rooms/11 + 6
 
Wes
#sigh
 
0
Q: Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in ...file

SaitamaI am trying to play around with pthreads and faced some headdesk thing... So I basically have this simple class: class ThreadDispatcher extends \Thread { private $ToPerform; private $arguments; public $response; public function __construct(callable $ToPerform, array $arguments)...

^^
 
emit a long, deep audible breath expressing sadness, relief, tiredness, or similar.
#?
 
@JoeWatkins I know you are a lil' busy right now... but.. could you please take a look at the question?
@SagarNaliyapara it's hashtag
 
@SagarNaliyapara I basically know only single song from them
 
9:23 AM
which song? @tereško
 
some non threaded class has closure as member, and it's either in context somewhere that is copied (ex handler for example), or you are setting that as a member of a threaded object ...
 
@SagarNaliyapara hmm ... wait no. Confused it with "Three Days Grace"
 
@PaulCrovella I don't think it would be sane without generics anyway
 
There is confusion hi Confusion no solution found error
 
@Wes trollololol
 
Wes
9:30 AM
#doublesigh
 
@JoeWatkins it is a not threaded object which is having a clousure as a member
 
nothing I can do about that, find another way ...
 
@DaveRandom we're currently looking at the possibility of a piecemeal type system where ?null | void? could be a thing... or might have all or most of those bits but not allow some of them together, or maybe sometimes, who knows. Color me skeptical about the sanity of linq in php with or without generics.. or hell the sanity of generics as far as that's concerned
 
@Saitama What is $a in you code sample?
 
9:33 AM
@JoeWatkins well... If i make the... class which is having the clousure as a member, extend the class thread would things work out?
 
yeh that ain't gonna work, you can only pass things which are serializable between threads
 
@DaveRandom No way
 
@NikiC Yeh I realise that now
shame, but I get why
 
@DaveRandom I actually named $a to $sampleObject when I pasted it in SO... and had $a in my local...
so... forgot to rename it...
 
@Saitama essentially you can only pass information between threads, not logic. So if you want to do something like that, you have to pass the information you need to the thread, let it do its work and then pass the resulting information back, and then put the result processing logic in the calling thread (if it needs some other state from that thread, which I assume is the reason you are trying to do it in the first place)
 
9:38 AM
Can't seem to find it, is there an OOP pattern which supports executing a chain of commands, with rollback support?
 
Think of a HTTP request... you send some data to the server, it sends the data back, you don't expect the server to process the resulting data @Saitama
@Sean I know you will hate me, but goto is actually quite good for this
 
@DaveRandom Fetches pitchfork
 
function transaction()
{
    if (!doThing1()) {
        goto undoThing1;
    }
    if (!doThing2()) {
        goto undoThing2;
    }
    if (!doThing3()) {
        goto undoThing3;
    }
    return true;

    undoThing3: undoThing3();
    undoThing2: undoThing2();
    undoThing1: undoThing1();
    return false;
}
 
209
Q: GOTO still considered harmful?

Kyle CroninEveryone is aware of Dijkstra's Letters to the editor: go to statement considered harmful (also here .html transcript and here .pdf) and there has been a formidable push since that time to eschew the goto statement whenever possible. While it's possible to use goto to produce unmaintainable, spra...

@DaveRandom
@Sean
 
@Sean check your GoF index for "undo"
 
9:44 AM
Alternatively you can have a queue of callable do/undo pairs, and a stack of done things. You dequeue things and do them the push them onto the stack, when one fails you pop the stack and undo things @Sean
@SagarNaliyapara It's abusable, but that doesn't make it useless
 
@DaveRandom Aye, that was what I was thinking about, never looked at GOTO that way before though either!
 
@bwoebi We should resolve c) upfront, to reduce surface area. Looking at your patch to reflection, it's not clear what you're doing there. Why do you use the prototype scope for closures? Shouldn't we instead replace the in-place constant update with an out-of-place one, so that evaluation occurs with the current binding (and if you rebind it will occur with the new binding)?
@bwoebi Overall the change looks pretty complicated :/
Where does the extra complexity come from relative to the previous patch?
 
Was afk for a while... I think I get it @DaveRandom ...
 
morning
@NikiC the problem is that statics should be a reference to each other (else we get that problem, I've described yesterday)
@NikiC yes, it's doing multiple things all strongly related to each other
@NikiC Actually, it's not particularly more complex than previous patch, except for the opcache approach
 
10:00 AM
@bwoebi mornin
 
@NikiC the static value should not depend on which binding was first used in the Closure.
 
@bwoebi Are you saying that all rebindings of a closure should share statics?
 
@NikiC yes (except lexical ones) … and all instances of them.
At least that's IMO quite the point of a static to be function local, not instance/binding dependent
 
A couple existing bugs about the static situation in classes
 
yeah, It'd make them all consistent
 
10:07 AM
@bwoebi The question is in which direction consistency should go
 
@NikiC the other direction can't be really achieved
except if we're duplicating
 
Consider that in typical auto-loaded codebases classes are generally not early-bound
 
@NikiC which is an issue then
as you'll inherit the current value
you first execute a function on parent
and only then load child
 
Does the late-binding behavior match with the new behavior you're suggesting?
 
child inherits parents current value
@NikiC yes and no … it matches under condition that parent function is called before child is loaded
we have two behaviors currently depending on order of instructions
 
10:10 AM
@bwoebi Ah, how is that supposed to be possible?
 
@NikiC because the first bind_static currently creates a reference, which is duplicated in array
=> reference shared
but if's inherited before any duplication => no reference, not shared.
(I've only wanted to optimize, saw an inconsistency and then it went the wohle rabbit hole down…)
 
hello
 
@whyguy hello
 
@bwoebi Assuming we subscribe to the interpretation that a rebound closure is the "same function" as far as statics is concerned, why should it not evaluate constexprs with the scope of first execution?
 
@NikiC because we then introduce again a dependency on order of instructions
it'd then depend on where $f1() or $f2() comes first (depending on what they're bound too) and $f1() shares the value with f2, which may not be expected?
 
10:19 AM
static $foo = self::BAR;
// should be roughly equivalent to
static $foo;
if ($foo === null) {
    $foo = self::BAR;
}
 
under that perspective…
possibly I shall revert that one then
less controversy when merging patch ^^
 
I'm not totally convinced about methods yet either
But I can see us just going with the interpretation that is easier to implement :D
 
that should be this one then :-D
 
I know
@bwoebi it would have a certain resemblance to static class properties
Which are also fully shared when inherited
 
ugh, half of my sizeof() calls in the patch are wrong … forgot a dereference :x
 
10:23 AM
Is it possible to fix this independently of the rest?
 
@NikiC not really. at least not in a way compatible with opcache
because we'd need to introduce references at compile time then
and then need to specially patch (like in my patch) opcache.
the change of the structure is one thing, but it's partially also because easier to manage within opcache
 
what do you guys use apache or nginx?
 
@whyguy People in here use either nginx or web servers they wrote themselves
 
@NikiC and they are usually written in C, right?
 
@whyguy Ah no, the latter category are servers written in PHP
 
10:33 AM
@Saitama yes
@DaveRandom pthreads can serialize closures, zend won't ...
 
@whyguy C is too low-level for a webserver :-D
 
@JoeWatkins is that as adventurous as it sounds?
 
@JoeWatkins wait, what? won't it clone the bound $this?
 
@bwoebi hrm...
 
If it weren't for opcache, it'd be all much simpler
 
10:36 AM
@bwoebi what you mean? you have your own web server in PHP?
 
@NikiC not adventurous for pthreads ... unfortunately :)
 
@whyguy uhm… yea. github.com/amphp/aerys if you're curious ;-D
 
@DaveRandom to be precise, it will allow you to set members as closures ...
 
@NikiC Servers? Anything other than Aerys?
 
@bw
@bwoebi this is neat
 
10:42 AM
Zend/tests/035.phpt … wtf is that allowed at all?!?! \cc @NikiC
 
@DaveRandom @Wes @PaulCrovella it does what wes said it does. If's an attempt to preserve formatting. It's the only thing I could think about to keep the meaning of messages.
 
hmm
 
@bwoebi is it possible to create real time applications between clients and server using aerys
 
@bwoebi Which part of it?
The duplicate statics or the static in pseudo-main scope?
 
the former
the latter is weird too
 
10:43 AM
static inline const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
{
    const char *ret = zend_get_opcode_name(opcode);
    if (ret) {
        return ret + 5; /* Skip ZEND_ prefix */
    }
    return "UNKNOWN";
} /* }}} */
 
@kelunik Dunno. The icicle thing doesn't have a server?
 
I love this method
return ret + 5;
 
@PeeHaa yeh I get it now, for some reason I read it as a really complex way to do nothing (as if the text would be parsed as HTML again)
 
@NikiC nothing really usable yet though (AFAIK)
@Andrea hehe
 
@Andrea What abound it?
 
10:44 AM
@Andrea much simpler than ugly substr()'s in PHP :-D
 
Also fwiw if you search chat I thought phpstorm was applying the style instead of telling me it was deprecated :P
 
@bwoebi It's fine to forbid it
 
@NikiC I don't know. It's just quite elegant.
 
Mornings btw room
 
We shall overload "str" + $n to substr() :-D (j/k obviously…)
 
Wes
10:47 AM
 
@bwoebi we already have sizeof()! :D
shudders
OK, I'm trying to figure out what code I need to take some filename, compile that file, and give me an oparray
 
@Wes way ahead of you, already implementing it :-P /cc @PeeHaa
Not sure how twitter will handle that in terms of char limit?
 
Wes
bs, i've invented unicode, you can't steal my idea :B
 
2 hours ago, by DaveRandom
awful, terrible, worst thing I've ever seen bar nothing
 
@Andrea you mean in textual form?
 
Wes
10:51 AM
twitter will count it at two different characters, but if you run it through Normalizer class, maybe it will collapse something, lemme try it
 
@Wes It's a diacritric mark though, do those count as chars?
If so, that sucks
 
@Wes on my phone I just see boxes around characters
 
@NikiC no, I mean literally just a zend op array pointer
once I have an op array I can work with it
I'm trying to figure out what's the right way to get to that point
 
@Andrea compile_filename or so?
 
@NikiC that seems like the obvious way, I should do that rather than try to RE phpdbg :p
 
@Andrea It quite literally takes a filename and return an op array ^^
 
Wes
@PeeHaa #fail anyway nope, it doesn't look Normalizer can do anything to reduce length
 
I don't think you can do better than that
 
Wes
@DaveRandom yeah it's a shame, i just checked. - is counted as a standalone character -__-
 
Yeh I just read dev.twitter.com/overview/api/counting-characters which is reasonable
And there is no short NFC for that because otherwise we could just use those chars
 
10:59 AM
@NikiC yeah :p
 
lol that is new. Chrome crashes when trying to upload an image
imagick? :P
 
Wes
@PeeHaa not new at all. sometimes chrome crashes just to open the file picker (for both upload and save to disk)
 
> An error occurred while checking for updates: The updater is currently running. Refresh in a minute to check again.
So I'm once again screwed
 
Win?
 
yea
 
Wes
11:00 AM
Win, the root of all evil
 
Windows update is stuck, reboot
 
But that's the chrome updater :P
 
It locks up msiexec
 
oh
I just booted 1 minute ago :P
Oh well. Thank god for ssds
 
It will resolve itself if you just wait
 
11:02 AM
Nobody just waits
 
Windows update has special hooks in the kernel since 7, the kernel will kill it if it doesn't respond after a few min
 
^ that's mobile @Wes
 
(apparently actually fixing windows update was too much hassle)
 
I saw a kxcd of that yesterday
when I was testing stuff
 
@NikiC only thing I'm wondering about … for traits I should maybe separate the references in static_variables… do you agree? As traits are supposed to be literally copy-paste (i.e. function clones)
 
11:04 AM
!!xkcd kitchen clock?
 
Androids unicode support does suck
 
!!xkcd reboot
 
\o/
 
$ucor=array(2,1);
$realcor=array(1);
$out=sort($ucor) == sort($realcor);
print_r($ucor);
why this return true ?arrays are different
 
Wes
11:05 AM
yeah just checked, also here font fails. on both android browser and chrome
 
@DaveRandom True
 
I have no idea how those light timers work btw. All the dials and switches.
 
1 message moved to bin
 
Pin the tail on the donkey is a game played by groups of children. The earliest version listed in a catalog of American games compiled by the American Game Collectors Association in 1998, is dated 1899, and attributed to Charles Zimmerling. It is common at birthday parties and other gatherings. A picture of a donkey with a missing tail is tacked to a wall within easy reach of children. One at a time, each child is blindfolded and handed a paper "tail" with a push pin or thumbtack poked through it. The blindfolded child is then spun around until he or she is disoriented. The child gropes around...
 
Wes
could be because it's monospace tho
 
11:07 AM
@FastSnail Stop using retarded variable names
 
@Wes It's a known thing in EU stock Android builds, as soon as you stray outside latin/cyrillic it's very hit and miss
 
@PeeHaa it has a meaning usercorrect and realcorrect
 
Yes retarded
 
may be.too long i have to reduce size
 
@FastSnail sort() does not return the arrays
 
11:09 AM
No you don't
 
It's by ref and it's return value is not useful like that (or at all, really)
 
@DaveRandom ok i got it.so it change the actual array.and i have to compare actual arrays?
 
$ucor=array(2,1);
$realcor=array(1);
sort($ucor);
sort($realcor);
$out = $ucor == $realcor;
 
thanks you.i got it
 
But PeeHaa is right, change your variable names to something more readable. Long variable names don't affect the functionality of your code, but they do make it more readable.
 
11:12 AM
ok i will.thnks for the suggestion
 
It's general advice. Readability > shortness. Also when talking to people...
 
nh, fk vwls, dn't hv tm fr tht sht
 
Anonymous
Does anyone know how the SurfaceBook compares to Dell XPS 13?
 
This is probably the wrong place to ask that question, hardware forums for that sort of thing
 
11:29 AM
All I can say is that 13 sounds too tiny to work on
 
@PeeHaa any idea which request makes the server consider you have joined a room?
 
Why do you think it can only join a single room :P
 
:-D
To the breaking-shit mobile!
 
:)
Can I create a new plugin?
I doubt it will get in your way
 
$ sapi/cli/php -r 'var_dump(opcodekit_compile_filename("foobar.php"));'
Segmentation fault: 11
PROGRESS
 
11:33 AM
Yeh no worries, I'm trying to make multi-room work first before I touch that
 
kk
 
The only thing that will change for plugins there is that postMessage() etc will require a room number, but I'll fix everything at once for that push and the data is right there on Message
 
cool
phpstorm's dark theme doesn't work in the sun :(
 
@PeeHaa try the light theme
(the best theme btw.)
 
I normally like dracula in because it's easy on the eyes. But I'll see if light works in the sun
light I can read
 
11:42 AM
Darcula
 
hmm
maybe I should make this integrate with Reflection…
 
@Fabor wow
 
@NikiC I think I've now fixed all the bugs (at least Zend/ tests pass)
 
/* {{{ proto array opcodekit_compile_filename(string filename)
   Compiles given PHP file, returns opcodes. */
PHP_FUNCTION(opcodekit_compile_filename)
{
    zend_string *filename;
    zval filename_zval;
    zend_op_array *op_array;

    if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &filename) == FAILURE) {
        return;
    }

    ZVAL_STR(&filename_zval, filename);

    op_array = compile_filename(ZEND_INCLUDE, &filename_zval);

    if (!op_array) {
        RETURN_NULL();
    }

    RETURN_LONG(op_array->line_end);
^ progress on my project
oh heck actually
 
It's amzing how often you can read over something @Fabor
 
11:48 AM
I was wondering about how to organise this, but now I realise
I should just map the C structs directly to PHP objects
“just”
 
@PeeHaa heh yes, it's okay. Dracula is alright too.
 
:P
 
now to remember how to make a class in C…
is ajf\Opcodekit\OpArray a good class name?
 
Wes
@DaveRandom missed this. but i would rather focus on void->null
@Danack @LeviMorrison is any of you going to work on void to null rfc?
 
@Andrea TBH, it's usually copying snippets around from somewhere else ^^
 
11:55 AM
@Andrea yes
 
@bwoebi yeah, I usually look at zend_closures.c, so I'm using it this time :)
@NikiC good ^^
ok, so, what's the difference between 1) a private empty constructor and 2) a public constructor that throws an exception
 
@Andrea 1) is statically checked
 
@Andrea first time Engine throws (a fixed error) or you can throw a custom one in latter case
@nikita2206 no?
 
@bwoebi zend_closures.c does both :1
 
@bwoebi not in the php itself
 
11:58 AM
@Andrea because of ReflectionClass::newInstanceWithoutConstructor()
 
@bwoebi WHY DOES THAT EXIST
I hope to god that's not possible for internal classes…
 
Hello, consider the following scenario, i have a html table, 'a procedure', this table 'procedure' is made of multiple steps, 1 line = one step, each line has a checkbox, when all check boxes are checked the so called run of the procedure is considered complete. Multiple users need to be able to participate in checking those checkboxes, in fact a step can be run 'checked' by a certain user profile. What i want to achieve is when a users checks a checkbox from one side i want the others to get
 
@Andrea for joys and tears!
 

« first day (2028 days earlier)      last day (2920 days later) »