« first day (2047 days earlier)      last day (2900 days later) » 

11:01 AM
Also because we can execute commands concurrently for a room, it is possible that a double !!command map would lose one or the other in persisting it
Same goes for !!ban, !!admin add etc
 
@DaveRandom Not if you use the native loop and don't yield between read and write.
 
we don't (currently) have any locks that would prevent that issue
@kelunik well it's cached in memory now anyway, so reads won't hit the file system most of the time
 
In that case you should force a read and write, should be way easier than locks.
 
like I say, needs code review, I'm not afraid to be told it's terrible :-D
 
Why do you not just succeed the promise with the read data? Instead of reading the cache store value then?
You could make it return a Promise directly, because you can return directly here without yield: github.com/Room-11/Jeeves/blob/master/src/Storage/File/…
 
11:08 AM
@kelunik Can you comment the commit? I don't have time to fully discuss atm but I'd appreciate the feedback and would like to discuss later
 
github.com/Room-11/Jeeves/blob/master/src/Storage/File/… < Will hide all thrown exceptions, it doesn't rethrow and doesn't log.
 
@kelunik that's deliberate
When we can't read or decode the file, trash it basically... there's not a lot we can do to recover from that kind of corruption
well, there is but it's still a very simple approach, I've no objection to trying to handle it more gracefully
The only things that can throw there are I/O errors (can't really recover from those) and JSON decode problems, which implies the data is corrupted
 
@DaveRandom what's the point of the finally there?
coroutine generators will never be left in middle of execution
 
I think the try block originally returned
reading that code back there are a few artefacts of previous iterations
same goes for the first line @kelunik pointed out
oh wait isn't there an issue with inner finally blocks not executing in PHP 7 currently?
that might be where we hit a deadlock, if that's what going on
right I really have to go do some work, feel free to attack that diff and/or fix things you don't like
 
@DaveRandom Then catch only FilesystemException.
Otherwise there will be cases where you catch a TypeError or something like that.
 
11:35 AM
how do I get 10 random values at the same time? I keep getting duplicates with mt_rand...
 
@Patrick 9, 9, 9, 9, 9, 9, 9
:)
@Patrick random_int
user image
4
 
initiate 10 threads, and get the value of mt_rand in the separate threads
 
Random !== unique btw
 
I just realized I might have messed things up somewehre else
 
ok @bwoebi @kelunik @rdlowrey so I'm still not clear on what the consensus view on how to deal with warnings/notices from a pgsql command is. As I see it there are two options: Connection#getErrorInfo() or returning some kind of proxy CommandResult object which has getWarnings(), getNotices() and getCursor().
I'd prefer to have Connection#executeQuery() and QueryStatement#execute() return a Cursor directly, but I'm now thinking that something which wraps the data and error info into one is probably the better of the two options.
(or a third option?)
 
11:37 AM
throw an exception (fail the promise)?
@DaveRandom and eventually expose the error info on the exception via an extra function
 
@DaveRandom You could make Cursor have a getWarnings().
 
@bwoebi The thing is, warnings and notices are not explicit failures. They return a result set as well
(or a rowcount)
 
oh
 
The command still executed, it's more like E_NOTICE
 
I've read getERRORInfo and then was totally…
 
11:39 AM
Well yeh, also not sure what to name something like that
 
Eventually take a look at amphp/mysql how it's solved there
 
@kelunik yeh that would work for Cursor, could have some kind of CommandResult for command statements (insert, update etc)
at the moment just return the number of affected rows
@bwoebi getConnInfo(), unless I'm missing something
Which is the former approach
Which I don't like, for a reason I can't really describe
it's also what PDO does
If that's the way to handle it, then it's a definite case for the existence of Statement#getConnection() etc
actually @bwoebi thinking about it that's the only way to handle it, because there are some places where we can't sanely return any kind of useful wrapper object (listen/notify, probably transactional stuff)
ugh, fine
 
12:05 PM
if i have a string in which i have image names delimited by say ¤¤ image ¤¤ , how can i easily get all the images if i have more then one, let me explain : if i do an $images= explode( "¤¤" , $string ); the first image will be $images[1] , but how can i easily guess the second third etc ... because the second image won't be $images[2] it will be $images[3] ... please help
 
@Joseph that sounds like a terrible data format
 
Where is it coming from?
 
@DaveRandom i know we probably have had a discussion around this subject before
@DaveRandom it's coming from a doc file
@DaveRandom i guess after the first occurence i'de have to skip one each time
@DaveRandom but that just doesn't feel like the sound thing to do ...
 
@DaveRandom
 
12:10 PM
Yeah, nice ping spam @DaveRandom LOL
 
cheers guys
 
yea sorry for that ..
 
I hope he has his pings muted ;-)
 
I suggest removing the delimiters from either end and then explode($delim . $delim, $data) @Joseph
then you'll end up with a flat array of data starting at index 0
 
Alright Dave thank you.
 
12:13 PM
or you could use preg_split()
 
I'll give it a try as well , thank you .
 
@DaveRandom :-P
 
Please vote for callable prototypes :(
typedef can be added later if you really want that
@Sara type aliases are nice, but I don't think they should be required in every case, and they could be added later
@Sara callable is already used like that. if we were to use function here instead that'd be inconsistent with the existing type declaration.
 
@Andrea /me puts yes vote … It pretty much looks like people don't want e.g. functional interfaces or similar, and I find it a nice thing.
 
The approach this RFC takes is the one I thought was most obvious
 
12:27 PM
The obvious solution is not always the best one
 
That's true.
I personally don't like the idea of being required to use a type alias. No language with a type system that I've used has required that.
If the callable signature is short and sufficiently descriptive, and is used only by one particular function, why declare it separately?
bool array_walk (array &$array, callable($value, $key) $callback, $userdata = NULL);
 
I agree on that and that's why I've voted yes
And I disagree with e.g. @Danack that callable length is too much of an issue. Whoever nests them three times shall be hanged anyway. that's what typedefs shall be for and added later.
 
@Andrea if I pass a callable(int) to something asking for a callable(int, int) will it fail? If I pass a callable(int, $mixed) to something asking for a callable(int, int) will it fail? If I pass a callable(int): int to something asking for a callable(int) will it fail?
 
yeah
 
If "no" to all of the above then +1
 
12:32 PM
function usort (array &$array, callable($a, $b):int $value_compare_func): bool;
@DaveRandom the RFC answers this, but I can't remember what it says :p
 
@DaveRandom it should not fail
 
“A function that takes less arguments than what is expected is also considered contravariant”
 
Damn, too slow ^^
 
function foo(callable($a, $b) $cb) { }
foo(function($a) { }); // callable($a) > callable($a, $b)
 
I somehow missed the entire variance section, reading
 
12:33 PM
to quote the RFC
 
+1 then, seems to be a devisive proposal
@Danack please can you sum why you voted no on that? I don't have time to pick through internals, wondering if there's anything I missed?
 
@DaveRandom .... look at internals, he has written a mail
 
Ugh, can't we tack a typedef RFC on the side to slide in at the same time?
 
@Sara @JoeWatkins @NikiC After reading multiple times through the callables RFC … I don't find really anything why the feature shall be rejected. Am I missing something? I'd be happy to hear why and eventually redecide.
 
^ this
 
12:37 PM
> I think we definitely would need type aliases. But I also hoped for
union types to get in, so that after these two we could have another RFC
that would do typedefs for callables and for unions.

Doing typedefs for callables only seems too narrow. People would
probably vote 'no' for that RFC because apart from creating new syntax for
callables it would also create a flavour of typedef that works in limited
scope only. And that seems completely fair, typedef is another feature.
 
it's okay to lobby people here because I'm not the author, right? :p
 
@DaveRandom to quote Nikita (Nefedov) from internals ^
 
I hate to harp on about it, but C#
 
@Andrea I'd first like to understand why certain smart people voted no before going to lobby ^^
 
delegate keyword
 
12:38 PM
having a type alias syntax would be handy as an alternative to class_alias
 
I think that's a muddy issue, trying to have some kind of type system that encompasses delegate types and "regular" types is hard.
I see no issue with treating delegate typedefs as different, because they are
 
function array_walk (array &$array, callable($a)|callable($a, $b) $callback, $user_data = null): bool;
*sad panda face*
 
@salathe it's contravariant
 
It's just callable($a, $b)
 
7 mins ago, by Andrea
“A function that takes less arguments than what is expected is also considered contravariant”
 
12:41 PM
How does that work?
 
It works as expected!
 
In the same way as you can do function foo($a) { echo $a; } foo(1, 2); without error
 
is sad that attributes is set to get a no vote
 
function array_walk (array &$array, callable($value, $key) $callback, $user_data = null): bool;
 
hey thanks for voting in favor @Andrea @bwoebi
@Danack I hope my comment on reddit won't come as aggressive to you
 
12:43 PM
@DaveRandom but it's the other way around
 
oh, @DaveRandom too :P
 
@salathe no, it isn't. array_walk() is passing two args to the callback, the callback is free to ignore the second
wait
 
@DaveRandom haha okay so array_walk() wasn't a great example
 
no that is right
@salathe :-D
 
So if I pass function($a){} to a parameter declared as callable($a, $b) that's going to barf, right.
 
12:45 PM
@nikita2206 callable($a) : int | callable($b): float is unambiguous (with unions) as you cannot have other callables (with signature) as return type (?)
 
@nikita2206 I'd like some kind of delegate FooCallable(int $foo, string $bar); on top of it, but not having it is not a blocker for me
@salathe no, the other way round
 
@DaveRandom wha?!
ok so it's clear I need to put on my thinking hat today. :P
 
@salathe That example is function foo($a) { echo $a; } foo(1, 2); (which is fine), the other way round would be function foo($a, $b) { echo $a; } foo(1);, which would error
 
@bwoebi it is not actually. Parenthesis would help here. Sara already pointed out her dislike for a lack of need of parentheses around callable prototype and I'm thinking if I should go on a limb and pull out from vote and make a change... Because I actually agree that they would be useful
 
@DaveRandom yeah that makes sense, ignore me. :)
 
12:48 PM
namely, she was talking about this: function ((callable($a): int) $cb)
 
@nikita2206 function bar(callable(int $number): callable(int $number): callable(int $number): parent_callable $recursiveCb) { // this wouldn't work currently
 
@salathe It's hard to think about I agree :-D
 
Am I misunderstanding the example then, when you say it doesn't work?
 
So now your example would be distinguishable in the parser if written as function ((callable($a): int) | (callable($b): float) $cb)
 
@bwoebi that is of course a hideous thing to do anyway...
 
12:50 PM
@bwoebi it is talking about referring to the parent callable prototype, but you can still chain them infinitely
 
If only there was an RFC so we could do function foobar(MyParticularBrandOfCallable $a) {} and pass in a simple closure. :P
 
delegate MyParticularBrandOfCallable(int $foo, string $bar): float; ... (is what I want)
 
@nikita2206 oh, okay. So, I was clearly misled by it ^^
 
@bwoebi you can check it on 3v4l.org . This code will work: function bar(callable(int $number): callable(int $number): callable(int $number) $cb) {}. It was just pointing out the inability to have some kind of parent_callable (so there no way for recursive callables to exist - f.e. middleware interface can't be expressed currently because it's recursive) - that is something only named types could solve
 
I think I will make the Rebecca plugin into a full fledged webservice
 
12:53 PM
@DaveRandom what does that delegate do? is that similar to a typedef?
 
@Gordon Bored much? ;-)
 
@Oldskool compiling
 
@bwoebi yes, but specific to callables. In the same way as class is specific to defining a class. It's a special kind of typedef
I think trying to shoe-horn an all-encompassing typedef that can handle this and other things is a mistake
 
@nikita2206 We also may allow standalone callables, and force parens if used in unions
@DaveRandom having 3 different variants of typedefs for unions, aliases and callables should be bad too
 
@Gordon You're kidding, right? :')
 
12:56 PM
@bwoebi really? because I'm pretty certain that this is what every other language apart from C does...
 
@DaveRandom Oh?
 
@DaveRandom huh?
 
There's a reason that class, interface, trait are separate keywords, they define different types of type
 
@DaveRandom Yes. But there's just one typedef
 
Which does what, precisely?
In a sentence
 
12:57 PM
@DaveRandom so, for normal callables you'd use delegate, but for unions with callables you'd use typedef? that's weird
 
@bwoebi Why not union?
Why not different keywords for different types of type?
 
@DaveRandom creates an alias for a type
 
@DaveRandom and intersections also?
oh, stop it now
 
This isn't an idea unique to C. I mean, heck, Haskell does it, and it's a completely unrelated language
 
@Andrea right. But the type itself is declared with it's own keyword
 
12:58 PM
@DaveRandom not really, Haskell has data, Rust has type
 
@DaveRandom event MyParticularBrandOfCallable MyParticularBrandOfEvent; :)
 
@DaveRandom yes, but callable(int, int) isn't declaring a new type
it's more like… an instantiation of a type.
 
it's a composite type, just like class Foo implements X, Y, Z
 
@Andrea exactly, callable is a type constructor
 
@nikita2206 yeah
 
1:01 PM
I'm don't understanding why there's such an aversion to treating this special thing as special
 
because it's not special?
 
@Oldskool no. it's really like in !!xkcd compiling
 
Yawn
 
@Andrea Why is it any less special than class creating a special kind of object composed of other things?
 
@DaveRandom class doesn't create an object, it creates a new type
callable, however, is an existing type, built in to PHP
 
1:05 PM
@Andrea It's still is_object() (is what I meant by "special kind of object")
 
@DaveRandom the class isn't, its instances are
 
class Foo {} interface Foo {} delegate Foo() union Foo Bar|Baz are all creating types, they are creating different kinds of types
The fact that some are composed of other types is niether here nor there (to me), they are all creating types and they are all doing it in different ways
 
@nikita2206 may you please draft a typedef RFC and push it to discussion?
I suspect this might increase chances of passing the RFC
 
@Andrea think about reflection - how do I distinguish between a union composed type and a callable composed type. They would have different reflection APIs, because they are different kinds of thing.
 
@Gordon Let me just pick my jaw up from the floor.
 
1:10 PM
@DaveRandom union types are kinda oddball
heck, nullables are too
 
@Andrea So's everything in the context of everything else, that's why we treat them differently ;-)
 
they can be used as a type declaration, I suppose, but they're not types actual values can have
there's no such thing as an int|string
 
(full disclosure: I'm currently in love with C# and want to have it's babies)
 
@bwoebi I'll look into it later today. Still given the kind of reaction @Joe gave, I'm not sure it will change his mind
 
callables are also not a real type, but they're much closer to one
 
1:13 PM
@Levi we really ought to bring union types into vote very soon…
I'll be very annoyed when they aren't into vote until end of week
 
@bwoebi huh, what? the RFC isn't complete enough to go to vote
it has several unsolved issues!
 
@Andrea Sure, I meant he shall clean up the RFC and then push it to vote.
 
@bwoebi a week is not enough time
 
@Oldskool why? Oo
 
@Gordon Because I always assumed you weren't that crazy, now I now better ;-)
 
1:16 PM
the patch is proof-of-concept, there's multiple open issues, and there's very little detail
also, I think Levi was hinting at scrapping void, but that's not in the RFC yet, so I don't know what's happening there
 
@Oldskool doing Java mainly for a while now and getting ready for php-c. so lots of compiling ahead of me
 
"Exception in finally inside finally following try/catch containing throwing try/finally"
7
 
and there's also the issue that if union types and intersection types get approved, suddenly everything is more complicated
 
@NikiC Was that your last nights nightmare?
 
@bwoebi That's a test name of course ^^
 
1:19 PM
@NikiC “f*n*lly” you too, finally
 
@Andrea That's not going to be part of this RFC.
 
@bwoebi so it'd be a separate RFC union types would depend on?
 
How can I install xdebug for php7 on ubuntu?
 
@Andrea nope, the inverse
the RFC would depend on unions then.
 
1:20 PM
@user3002233 most likely the same way you got php7 on Ubuntu?
 
@Andrea I really think that if you focus on "how would I reflect on these type names that I am creating" you'll see what I'm getting at in terms of treating them differently. Or maybe not and maybe I'm wrong :-)
 
@Andrea I asked a clear question.
 
But I don't feel wrong :-P
 
@Andrea the patch is quite ready to be merged, just with all features, which may be sliced out easily when we'd decide to not vote on some or have a secondary vote on them
 
@user3002233 Well, how you get Xdebug for PHP 7 on Ubuntu depends on how you got PHP 7 on Ubuntu. Without knowing that, we can't help. Furthermore, you may not actually need our help if you can answer that, since the procedure for getting Xdebug should be similar to getting PHP 7 itself…
 
1:23 PM
@user3002233 Clear, yes. But Google is a better place to look for that
 
@Andrea yes. right. It was by apt-get install lamp-server^.
 
@user3002233 Okay. Find out how to get PHP 7 Xdebug from apt-get.
 
@Machavity come on! php7 is new. google doesn't know shit about it.
 
sudo apt-get install xdebug does not work? xenial lists an xdebug package
 
1:26 PM
@Machavity heh yeah. I was reading it before you sent it.
Yeah, But there isn't any ubuntu package for it. right?
 
@user3002233 you installed PHP 7 by an Ubuntu package, I'm sure there's an Xdebug package.
Consider searching the Ubuntu package repo.
 
If it were CentOS I'd know where to steer you. But I find it hard to believe nobody has a PHP7 build of Xdebug 6 months after it was released
 
@NikiC finally is the final circle of hell
 
@Andrea Thank you. Yeah, there is one. It's 'php-xdebug'.
 
@DaveRandom I guess my argument with callable and type aliasing is that you can already specify it inline, so we don't need a statement for it
 
1:30 PM
@NikiC Sounds like PHP7 just wrote the end of your next conference presentation. "And finally, exception" mic drop
4
 
But the PHP itself doesn't work! heh. I should work on it.
 
@DaveRandom I mean, if you could create a class inline (function foobar(class { ... } $foo) {}) then we'd declare classes as aliases (typedef Foo = class {...};), if that makes any sense
 
My first script in php 7: <?php php_info();
ERROR. 500 status code.
God bless me.
 
@user3002233 Since when does php_info exist?
That's news to me :)
 
@Oldskool I know! it's phpinfo().
 
1:35 PM
@user3002233 Then you also know (at least one reason) why it errors.
 
@Oldskool I was just showing you how I do programming. I learned programming with the errors.
 
@Andrea Yeh but you can't do that, and the reason you can't do that is because you could never satisfy the type because the inheritance is wrong. However, imagine I had a typed property of public MyCallable $callback - I could pass that to a foo(MyCallable $c), but I could also pass an anon function. Basically, given a type name I should be able reflect on it, and if I couldn't do that it would be a pretty serious wtf for me.
Since we already have ReflectionType it confused matters somewhat
 
@DaveRandom I don't see why we wouldn't be able to reflect on it…
 
does anyone still have a voucher for digital ocean credits to spare?
 
@Andrea Yes, but with a single ReflectionTypeDef that encompasses unions and callables, that would have two completely different sets of data accessor methods on the same object for different kinds of thing. It's basically an SRP violation
 
1:41 PM
@DaveRandom …huh? why would we have that?
 
if ($reflectionTypeDef->getKind() === ReflectionTypeDef::CALLABLE) {
    $reflectionTypeDef->getArgs(); $reflectionTypeDef->getRetVal(); // etc etc
} else if ($reflectionTypeDef->getKind() === ReflectionTypeDef::UNION) {
    $reflectionTypeDef->getComponentTypes(); // etc etc
}
vs new ReflectionDelegate('MyCallable') and new ReflectionUnion('MyUnion')
 
Can anyone explain this better? symfony.com/doc/current/cookbook/doctrine/…
 
They are two entirely different kinds of thing with entirely different kinds of data
 
I have quite a few custom types but don't really know what to map them as in the mapping_types
 
(so for me there's no issue with treating them as different things at decl time)
 
1:46 PM
@DaveRandom huh?
$reflectionTypedef->getType();
 
which returns what, exactly?
 
It'd be something inheriting from ReflectionType, or maybe ReflectionTypeAbstract
the callable types RFC under vote at the moment proposes ReflectionCallableType which extends ReflectionType
 
which is a totally different thing from a ReflectionUnionType
 
it probably would be, yes
 
...because they are different! :-P
 
1:51 PM
…and?
 
so why should they be declared using the same construct?
What's the need in creating this 3-way dep between 3 RFCs (callable types, union types and typedefs) when callable types and union types are unrelated
 
@DaveRandom they're not, they'd just be aliased with the same construct
unless you're also proposing yet another syntax for aliasing classes
and yet another syntax for aliasing scalar types
scalartypehintypedef Age = int;
 
@NikiC can you please explain to me why Exception("1") is swallowed? ideone.com/7oAyGv (same behavior in PHP)
 
typedef Length = int;
typedef JSONObject = StdClass;
typedef ArrayKey = int|string;
typedef MapCallback = callable(ArrayKey $key, $value);
aliasing type hints is kinda different to declaring wholly new types, actually
a class can be instantiated (and an interface implemented or a trait incorporated)
 
@Andrea this, I'm suggesting that delegate declares a whole new type
 
1:56 PM
but a type hint… can only be used as a type hint
 
ugh, I hate PHP sometimes, that doesn't make sense unless you forbid callable(int, string) etc in typehints
ffs
 
@bwoebi It's not swallowed
 
@bwoebi not answering the original question but just FYI, it's not outright swallowed, it's being suppressed and you can get access to all suppressed exceptions with e.getSuppressed()
 
In PHP it goes into the exception chain
In Java it's a suppressed exception
@nikita2206 <-- that
 
Bobs-MacBook-Pro-2:php-src-X bob$ ./sapi/cli/php -r 'try { throw new Exception(1); } finally { try { return $e = new Exception(2); } finally { throw $e; } }'

Fatal error: Uncaught Exception: 2 in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1
(with Dmitrys branch)
I don't see it in exception chain? @NikiC
 
1:58 PM
yeh OK @Andrea I'll admit defeat there, I'm not happy about it though :-P
 
@bwoebi it chains in my branch of dmitry's branch
 
so, we ultimately go to behaving differently than java? :-D
 
@DaveRandom not sure I am either
PHP's type system is a mess
 

« first day (2047 days earlier)      last day (2900 days later) »