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

7:01 PM
@kelunik It would have to special case Awaitable<Type> to understand what that meant when yielding it. I'm not going to hold my breath for the feature. :-)
 
ooooh damnit. I totally forgot to use amp/file in my logger :|
That was a good 15 minutes wasted
 
@bwoebi Because I'm not fully convinced that enforced callable signatures are a good idea
I like the documentation aspect
But I don't think we should force the caller to specify a fully typed signature
This is sortof fine currently where the signature would likely contain object types only. Those are useful to specify in the calling code as well for the IDE
But if you consider the "reduce" example right at the start of the RFC ... bah
 
@NikiC The prototypes do become rather unreadable in a hurry...
 
Wes
@NikiC i thought it didn't force that?
 
@Trowski I'm not (so much) concerned about the prototypes. I'm concerned about the calling code having to use a fully typed signature
 
Wes
7:16 PM
baz(callable(int $a) $c){}
baz(function($a){}); // works as "mixed" includes int
 
@NikiC the issue there is not the typing of the args, it's the number of args the callback requires
passing function ($a, $b) {} would work fine
 
@Wes It does? I did not find mention of that in the RFC
 
why aren't the numbers in order from highest to lowest? 3v4l.org/Ot9FP
 
Wes
i remember a discussion with @marcio about that, but i could be wrong
 
> whenever function of type F is expected, any function that takes equal or more general input than F and gives equal or narrower output than F, can be considered of type F
 
Wes
7:19 PM
in that case you are right it's gonna be super annoying
 
@DaveRandom And that includes dropping the type entirely?
It would make sense from a variance perspective, but method signature checks don't allow it and that sentence is not at all clear on the issue
 
@bwoebi is this correct github.com/bwoebi/php-uv#install ?
 
@NikiC args yes, return type no
which is what makes sense
 
@NikiC So forcing typing on callbacks just to fulfill the signature? I thought what @Wes said would work. If not, then I may change my vote.
 
If what @Wes says does work I might vote yes on this
In that case, should specifying a return type even be supported?
 
Wes
7:22 PM
maybe return could be obligatory
 
@NikiC yes, think factory functions
But note that a lot of the time, functions won't specify a return type because a lot of the time things that use callables ignore the return value
But if I need a callback that returns a specific thing then it should be guaranteed
 
@DaveRandom just to emphasize the email - i) we're still going to want to have 'named' callable types ii) if we had that, there would be much much less demand for this RFC. iii) I just don't like anonymous types, and think that even though it makes code harder to write, having names for all types makes code far easier to maintain.
 
If the return value (or type of the return value) is irrevelant to what I'm doing with the callback then I won't specify a type
 
@DaveRandom What should be guaranteed is that the callable returns that type, not that it specifies that it returns that type
 
7:25 PM
@MorganTouvereyQuilling tnx let me try that one
 
I don't want it to be enforced that I have to write setFactory(() : SomeInterface => new SomeObject) instead of just setFactory(() => new SomeObject)
 
@NikiC there's no other way to guarantee that though
 
Wes
baz(callable(int $a) : stdClass $c){}

baz(function($a) : stdClass {}); // works as "mixed" includes int
baz(function(float $a) : stdClass {}); // fails because float is incompatible with int
baz(function($a) : ArrayObject {}); // fails because ArrayObject is not a stdClass
baz(function($a) {}); // fails because return "mixed" is not a stdClass
 
@DaveRandom True (approx). In which case the next best thing might be not having that in the signature
 
@Danack I've spent a lot of time thinking about this today and frustratingly, mandating named callbacks isn't really practical because PHP's type system is so muddy. We need the ability to name them, but forcing them to be named "isn't very PHP" (i.e. will never happen)
 
Wes
7:27 PM
the float/int example was poor, but you get what i mean :B
 
I also wonder how expensive these signature checks are
 
@NikiC That's just going to result in an instanceof/is_* in userland though. I'd be OK if return type support was not included in the initial RFC in order to get something in though, not supporting it at first does not prevent it from being added later.
 
Are they done on every call?
Callable type checks are not cheap as-is, but I know that signature checks for classes have quite significant overhead for class binding
 
Basically @Danack PHP is full of things that let people write bad code, and people find creative ways to write terrible code around constraints that should make it harder all the time. I don't see that as a good argument against it in this particular case, when this does not in any way prevent access to the tools that can be used to write good code.
 
@DaveRandom most of them don't exist at a language level, and are from an era when people weren't thinking about stuff as clearly. Adding bad stuff when there are almost certainly better ways (and I don't share your pessimism about the alternatives) isn't how we should be adding stuff, imo.
s/and/or
 
7:33 PM
@NikiC this is indeed an issue, but perhaps some kind of normalised signature could be constructed for anonymous functions and attached to it at compile time to speed that up? No way around it with stringly typed callables or arrays though
 
Hello all. If anyone here is a Symfony buff, I could sure use the help with this small issue.
0
Q: Catch-all route in Symfony 3

bought777I have a catch-all fallback route in Symfony2 that I couldn't get to work in Symfony3. I tried this exact syntax (a verbatim copy of my Symfony2 route) and that didn't work. fallback: path: /{req} defaults: { _controller: MyBundle:Default:catchAll } requirements: req: "....

Would appreciate any help. Thanks!
 
@DaveRandom I like this idea. I think most callbacks will be anonymous functions anyway.
 
@DaveRandom I also don't think the problem is so urgent that we need to get a fix in for 7.1 - If people are really finding this to be a horrible problem for them, then couldn't they use an invokable interface to make their code safe...
> perhaps some kind of normalised signature could be constructed for anonymous
 
@bought777 Upvoted. You should look at the profiler to check how the routes have been matched. Don't hesitate to debug the Symfony router too, I'm not sure if it is the expected behavior.
 
$fooFn = Closure::fromCallable($fn, 'FooCallbleType')
ah harro
 
7:36 PM
@MorganTouvereyQuilling Thanks Morgan. Much appreciated! :)
 
@NikiC Can we get it approximately correct? :D
I'd be okay with that if you can pull it off.
 
@Danack I spent quite a substantial amount of time arguing for delegate CallableType(int $foo, string $bar): float this morning and eventually was talked out of it but now I'm not clear on why and I'm going to go away and think about it again
 
@LeviMorrison hm?
 
Return type inference on simple functions can't be that hard, right?
Right?
:D
 
@Danack a big part of the issue I could see this morning is union types though, and there's a definite argument that inline union types should be forbidden if inline callable signatures are forbidden (i.e. require union Foo Bar|Baz decl instead)
and that I'm struggling with
/me goes away to think some more
I definitely think that either you allow inline composite types or you don't, there's no middle ground where you allow it for some things and not others
 
7:44 PM
The Callable Prototypes vote count seems much too low.
@bwoebi I'm going to be busy for a few hours but can maybe answer questions if you have any about union types.
 
8:09 PM
can you please help me downvote this into oblivion or tell me how in seven hells can 8 people have upvoted it?
 
@LeviMorrison so, shall I try to polish the RFC a bit?
 
@bwoebi Yeah, sounds good.
 
@NikiC Are you actually enforced to write it that way?
 
@bwoebi I could really do with some assistance on the whole Connection#listen()/PromiseStream thing, any chance you can whip up a quick impl so I can understand the mechanics of it?
 
@bwoebi turns out that, no, you aren't
You are forced to write the return type though
 
8:11 PM
well, yeah, that's a nogo then \cc @nikita2206
 
So minus the return type support I'd probably be okay with it
 
@FélixGagnon-Grenier Upvote ring maybe? That's weird
 
@Machavity exactly my thinking. just before flaming meta I just wanted a sanity check. the question is horrible
 
@NikiC If the return type can be inferred at compile time then sure, drop the requirement to declare it explicitly
 
@NikiC that's quite part of the feature though… It rather should be contravariant here and duplicate the Closure, just with a return type check
@DaveRandom it nearly never will be, at least not the way PHP is currently designed
 
8:13 PM
@bwoebi not necessarily a closure though
 
@NikiC or wrap it into a Closure with a returntype check
 
@bwoebi that sounds very "ugh"
 
@bwoebi No indeed, and I still maintain that requiring the return type on the passed callback if the signature asked for one is correct, that's simple LSP
 
@DaveRandom you need an exact match here, that's the big problem
@NikiC why?
 
I don't understand why return type variance is not supported. I remember understanding it once, briefly, so I know there is a reason, but right now I have no idea what that reason is
 
8:17 PM
@DaveRandom the issue is, well, you need to wrap to enforce a more precise check
 
Ugh, ext/pgsql is missing some things
 
@DaveRandom What do you have until now?
@NikiC it's quite the only way it can be guaranteed that there are never invalid values, except by invariance
 
@bwoebi The other way is not supporting return types...
I don't think it will be considered acceptable that callables with prototypes will automatically wrap in closures
 
@bwoebi A mushy brain that can't understand it. Let me go have one more go at it.
 
@NikiC I think it would be reasonable to wrap only closures...
 
8:20 PM
@NikiC and not supporting it quite misses the point; in that case it's just more like a hint
 
If it's a class method then we require the return type
 
@nikita2206 but not contravariant then :-/
 
@bwoebi no, I mean forbid specifying a return type in a callable prototype
 
That's weird too then … "Closure or contravariant"
@NikiC Yes, got that. I mean, the whole callable is then more of just a hint
 
@bwoebi It's documentation
 
8:22 PM
yep
 
@bwoebi why not? return types are covariant by the way. And callable prototypes support this
 
And arity is still (partially) enforced
 
As in you can do this with this RFC: with B extends A - (function (callable(): A $cb) {})(function (): B {});
 
@bwoebi right so what I'm not understanding is how I "update" the stream. I create a deferred and return new PromiseStream($d->promise()), that's fine, but what do I do with that deferred when I have values to push into the stream?
 
@nikita2206 right, but the inverse should be true too
 
8:25 PM
Also, how do I cleanly "end" the stream when unlisten() is called?
 
@bwoebi what is the inverse in this case?
 
(function (callable(): B $cb) {})(function (): A {});
As the function may return an instance of B (as B instanceof A)
you only know it by actually checking the actual return value
@DaveRandom $deferred->notify() ?
 
@bwoebi What API were you looking for in the low-level event emitter lib? Something similar to Evenement?
 
@bwoebi I'm not following you here... If the return type is present then no need for wrapping? Just use the return type to make the type check of a prototype
 
@bwoebi I... did not know this was a thing
and then to end the stream I just succeed() it, presumably?
 
8:28 PM
@Trowski just a simple notify()/watch() API on top of Awaitable
@DaveRandom right
 
OK now I get it
 
something similar than what we have in Amp now, like @DaveRandom just asked for @Trowski
 
tnx :-)
 
@bwoebi So something like progress updates?
 
@Trowski literally what I am talking about here ^ :-D
 
8:29 PM
@Trowski well, that's what it ultimately is
your observable is also nothing else… pushing updates
 
That's where I'm confused... what's the difference between that and observables?
 
@Trowski none. Just that it can be used as simple Awaitable (i.e. can be yielded), does not require a generator to emit and that you can register a callback with updates
 
@bwoebi It might be better to change what I have into something like that.
 
I'm getting a 'Can't connect to MySQL server on '198.71.225.150' (4)' on my php file and all it's doing is simply asking to connect all the information I provided for it to login is correct.
 
I could make emit a separate method and add complete and fail methods.
 
8:33 PM
@nikita2206 nah, the function now expects the callable returning an instanceof B. The passed callable returns an instanceof A. [instanceof as in $a instanceof Class.] Now, the instanceof A returned by the passed callable may be instanceof B (it may also be any other class implementing A), but does not have to. Thus you need to wrap to check whether it actually returned B (and not any other instanceof A, which is not instanceof B).
 
Does wordpress block it's php files from accessing external databases?
 
@bwoebi I'll make a branch and show you what I mean. I think we're on the same page, but I need to make some changes.
 
@Trowski something like that. And then you can build the Observer (isValid()/getCurrent()) on top of that.
 
@bwoebi Ok. Objects using observables would then provide the iterator (or Observer) object to consumers, like a deferred providing the promise to consumers.
 
@nikita2206 note that this is a runtime check, in any case.
@Trowski basically that
 
8:37 PM
Yeah, I like that. @DaveRandom I used an observable in my postgres implementation for query results, I think it will make sense to do that in Amp as well.
 
@Trowski Because currently you're basically doing the same (in my eyes) mistake than you did in Icicle with the Streams … you provided a high-level (well, definitely not a primitive) API as lowest level to be interacted with in the whole ecosystem.
High-level APIs are nice for applications, but fundamentals always shall be available too.
 
@Trowski I'm not quite understanding that but it may make sense, I'm pretty tired. I really need to put the IDE down and walk away...
 
@bwoebi Yep, I've come to realize that.
 
Inside application code, using a watch() method (in Amp) instead of the PromiseStream abstraction is pretty much as insane as using a when() method there. [As in you can do it, but in general you should not do it.]
But in libs it's fine
@Trowski great :-)
 
@bwoebi You meant update() here I presume?
 
8:44 PM
@DaveRandom Is it called update? then probably that one :-D
nah, it's Aerys having notify() within Server … ugh, confusing things^^
 
@bwoebi can you just verify that github.com/amphp/pgsql/commit/… makes sense?
I think it does but would like to double check as I've had real trouble wrapping my head around this one
err.. docblock description makes no sense, ignore that :-P
 
@DaveRandom LGTM … I'd just not directly return the PromiseStream, but rather the Promise so that users can wrap it then github.com/amphp/pgsql/commit/…
 
@bwoebi issue there is that I'm already returning a promise so I can't resolve it with a promise because it would never resolve
@bwoebi maybe need a PromiseStream#getPromise() for this reason? Unless there's somethingI'm missing? (probably)
 
9:00 PM
@DaveRandom oh, true, my bad
 
Wes
@bwoebi check the mentions :P asked you something... no hurry though, just out of curiosity. i have no idea why that isn't working
2 hours ago, by Wes
@bwoebi do you have a sec? can you help me understand why the commented code doesn't work, but it works if i do array_merge? https://3v4l.org/tBY4O
 
@PeeHaa I've never touched that … try it? And do a PR if it's incorrect … I'm always compiling it statically^^
 
9:18 PM
My php form used to send to my work email just fine. Then it started sending it to spam. And now it wont send at all. Its probably just an issue with my work email but not sure
 
@Wes uh, good question … wut?
 
Wes
3v4l.org/sbaou yeah, i don't get why
 
user895378
I'm curious about the reasons people have for voting against the Callable Prototypes RFC ... it's functionality that I would have liked to have at various points
 
@rdlowrey Hu hu, I've just asked the same question earlier, you should scroll to the top a bit, that was an interesting debate :p
 
@rdlowrey the problem is covariant return types (instead of runtime contravariance)
 
9:28 PM
@bwoebi Obviously I did try it :)
And failed
 
@PeeHaa with which message or what?
Do you have libuv (the C library) installed?
 
@bwoebi yum says yes
However:
> # make -C libuv CFLAGS=-fPIC
make: *** libuv: No such file or directory. Stop.
 
try just make
 
> make: *** No targets specified and no makefile found. Stop.
 
no configure?
ugh the instructions show no configure
 
9:31 PM
@PeeHaa Did you tried the travis-install.sh finally? The install guide on the readme is broken
 
git clone github.com/bwoebi/php-uv.git --recursive
cd php-uv
phpize
./configure
make
make install
that should be all
wtf is that make -C thing????
O_o
 
hey it's your inherited readme :P
 
:-D
emphasis on inherited
 
@MorganTouvereyQuilling Nope. Trying to find out what's wrong in the readme instead
 
Not sure what to do? I use the email as a notification to check my website where the info is posted
 
9:36 PM
@bwoebi :-)
ugggh sucky remi php install with fucked up paths..
 
./sapi/cli/php -r '$g = (function($a, $b){yield from $a; yield $b;})([2], 1); var_dump(iterator_to_array($g));'
array(1) {
  [0]=>
  int(1)
}
@Wes that's indeed weird
iteration via foreach is fine
 
Wes
ah, that looks more like a bug. i thought i was doing something stupid as usual
 
hi all, wondered if anyone can help?
 
Wes
don't ask to ask
 
regarding my SO question I asked yesterday
what do u mean @Wes
 
9:42 PM
@Wes somehow a yield from in first place does not play well with iterator_to_array()
 
@TubeNations [...] just ask
 
ok @Morgan, well can i post the link to my SO question?
then i wont need to explain, i already explained what my new issue is in the question i updated
 
@Wes but well … it's your fault, obviously! If it weren't for you, nobody would know that bug and it wouldn't matter … but now it does!
 
Wes
lol, sorry
 
:-D
 
9:44 PM
@TubeNations Read the rules ;) room-11.github.io
 
hehe, so i already kinda broke 1 rule
lol
 
@Wes ah I know what's going on
 
by asking for help hahaha
 
sigh
 
ooops
 
9:45 PM
that's a paddlin'
 
@Wes please try specifying false as second parameter to iterator_to_array()
 
Wes
@bwoebi ha. it's my fault, i bet :B
wtf is that
sigh
 
well basically, i had some help yesterday from another SO user, and he helped me fix 1 issue and helped with my other, but now the function somehow needs to be recalled, when a user clicks the next or previous buttons on a jquery clside i have in the page
 
@NikiC we probably should increment the yield index counter after a yield from: currently $g = (function(){yield from [1]; yield 2;})(); var_dump(iterator_to_array($g)); returns [2] instead of [1, 2]....
 
i think it might need to use ajax
 
9:47 PM
@Wes It's not a bug per se, but rather bad behavior of PHP
 
Wes
is the array creation delayed or something
 
@NikiC but uhm … shall we really retain the index on yield from arrays?
 
@bwoebi I don't think so. You'd run into the same problem if you did two yield froms
 
Wes
i don't get it...
 
Just use iterator_to_array correctly
 
9:49 PM
@NikiC no, disallowing this specific case makes no sense… thus, we might just ignore integer index keys on yield from…
 
Wes
ah now i get it
 
@NikiC Yeah… but nobody uses it that way
 
@bwoebi which is a problem of iterator_to_array
Bad defaults
 
right
can we fix that? :-D
 
@bwoebi that might sometimes be desirable but a huge wtf at other times
Strong -1
 
9:51 PM
yeah, it's trading the one wtf for the other … but probably just iterator_to_array() shall be fixed
 
Wes
@bwoebi no. it must stay as specified in the array imho
 
In this chatroom we cannot send comment quickly.. I mean we need a short delay to send another comment here. How SO checks that? before inserting every new comment it checks all the database for the time of my last comment?
 
I asked anyway :)
 
Wes
also i think iterator_to_array has the correct default
i just wasn't aware of it
 
@Wes nobody is unless explicitly encountering this specifc issue
If the default were false, people would ask "how can I get the keys" and figure this out.
The way it is currently, it looks like a blatant bug and a biiiig WTF, they report or ask in a forum for it and or only then told the solution…
 
Wes
9:56 PM
iterator_to_sequence_array() :P
 
hence… probably, bad default.
 
Wes
don't think so, looks more natural that keys must be kept by default
 
@Shafizadeh if the delay is $X seconds, you just have to load the data posted between time()-$X and time(). But this is probably implemented on the messaging system, not on the persistence layer hm ;)
test
I don't notice that delay
 
Wes
@bwoebi or rather have a special syntax like yield values from $array;
along with other combinations, something like yield keys from $array => values from $otherArray;
thanks for the help though, i would have never guessed the problem was there...
 
10:06 PM
@Shafizadeh if I would have to guess, when you send your new chat message over websocket, on the server-side your profile is fetched from the cache and it contains the "last message timestamp". That's what limits your ability to spam the room.
 
@tereško Ah .. so that is nothing to do with database?
 
it's highly probable, that there is also "soft limit" enforced by javascript
@Shafizadeh no. The check happens before your message reaches the DB.
 
Ah ok, yes that's more reasonable
 
But, keep in mind that the StackOverflow is several orders of magnitude larger, than whatever you are making.
 
you cannot say that .. :) maybe a little
 
10:10 PM
SO currently has a little less than 5'000'000 registered users
anyways, I need to sleep
nn
 
Yes it is very more popular than mine, but I will arrive to near of that. And sleep tight
 
@tereško I doubt it… the error messages only show up after a short while (i.e. probably after a TCP roundtrip)
 
morning
 
@nikita2206 Don't worry about that at all. I've been "interacting" with P.M.Jones recently on Reddit - if you're going to want to compete on his level, you're going to really need to step up your passive-aggressive game and maybe start pretending people are saying things that they are not saying - as otherwise you come across as a fluffy bunny.
 
@tereško I would like an advice on this, because I see you as a jedi or something and value your input especially; I am not sure how far I should go in the circumstance where individual access my site paid-per-advertisement content with some ads blocker program on. It kind of piss me off because this is money earning to the garbage.
and everyone else advice too btw. I am in no way a jedi
 
Wes
10:31 PM
@Shafizadeh being too confident is the first step towards failure
 
I have a question.. in general ..why is it said that there is a demand for ruby on rails developers and they are paid more .. even when Rails is just suited to single threaded environments and nodejs/erlang/Akka/Go are doing better at concurrency ?
 
@argentum47 Salaries aren't based on languages capabilities on concurrency... :)
 
I mean, like if the thing is not good enuf in the long run then why would companies try to use it .. and I guess by basic finance knowledge if a thing is on demand and there is less supplies then there is a demand and hence more money .. isn't it like that in reality?
I just want to know why.. when I was doing php/nodejs at my home and now that I am in a job ... things are so different and I am so fed up ..
 
I just got this message "Remote host said: 553-SPF (Sender Policy Framework) domain authentication
553-fail."
 
@rdlowrey so upon inspection of ext/pgsql I find that it's missing a few things :-( can't do a like-for-like implementation in some respects
Notably can't do an async reset, and can't specify types for parameterised queries/prepares
Missing a lot of connection status constants as well
 
10:45 PM
What does it mean?
 
@Wes good point. thank you
OP stands for what?
 
Wes
original poster
 
really?
 
I'm stuck!
 
Wes
no i was joking. yes really
 
10:48 PM
good :)
 
user895378
@DaveRandom by "async reset" do you mean a connection reset or something else?
 
@MorganTouvereyQuilling Hehe … But no way around that I guess :x
 
https://t.co/YyZDD2Df10
 
Also PQstatus has a bunch of other possible statuses in async mode that ext/pgsql doesn't define (see docs for PQconnectPoll() etc)
The latter I suspect is less of an issue as pg_connection_status() probably just returns the int directly
however I currently remap it for a clean abstraction in pecl pq
 
Wes
11:05 PM
is there a standard-ish equivalent for @override in phpdoc? or a precedent in some framework?
 
user895378
@DaveRandom Are we sure they aren't defined? Because it's possible they just aren't documented :)
 
@rdlowrey ah true, have not checked
 
user895378
It might be an E_RDLOWREY_DOCUMENTATION
 
@NikiC yes, it works 3v4l.org/PgoBq/rfc#tabs :)
 
I'm going to go through a bunch of stuff tomorrow so I'll check it out then
 
user895378
11:06 PM
@DaveRandom As for reset, can that not be faked by simply closing and reopening the connection under the hood?
 
I'm going to bed, ping me if you have any additional thoughts. The stuff in the new-api should be functional with pecl/pq if you want to try it out, implemented basically everything but copy and exceptions
@rdlowrey reset keeps hold of stuff like prepared statement handles
 
Wes
@marcio nice! also hi \o
 
but yeh, probably
will look properly tomorrow
nn @all
 
user895378
@DaveRandom nn
 
Wes
nn
 
Wes
11:28 PM
i noticed return yield $val; works, does it do anything special other than returning null?
 
@Wes o/
 
Wes
'sup!
 
voting is 9/10 :<
not going to pass
 
user895378
@Wes it returns whatever the external controlling code sends back to the yield expression
 
Wes
@rdlowrey i don't get it 3v4l.org/r9t4U :\
@marcio how much time did you guys spent on the patch? :(
 
11:52 PM
@Levi I've cleaned it a bit up, decided on votes etc.: wiki.php.net/rfc/union_types … I'm not a great RFC writer, so someone else (perhaps @Danack or you) shall review it and maybe expand on it. But at least it's not in total discussion state any more now.
@DaveRandom why, what? Are you really using php.net docs? The only true doc in the source! Everything else is merely a guide...
 
Wes
if i may... i'd remove this I have personally wanted the ability to type against both array and Traversable in some of my libraries. it's not a good argument imho, as array should just be a Traversable itself
and also in the examples. that can't be a good justification for union types. imho
because it looks like you are introducing union types for the sole purpose of solving something that is obvious that should be solved in a different way (ie, by making arrays Traversables)
 

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