« first day (3991 days earlier)      last day (940 days later) » 

2:02 AM
@Trowski are you aware of this exception:
Error: Cannot call Amp\await() within an event loop callback in /home/bob/vendor/amphp/amp/lib/functions.php:33 Stack trace: #0 /home/bob/vendor/amphp/http-server/src/Driver/Http2Driver.php(367): Amp\await() #1 /home/bob/vendor/amphp/http-server/src/Driver/Http2Driver.php(727): Amp\Http\Server\Driver\Http2Driver->shutdown() #2 /home/bob/vendor/amphp/http/src/Http2/Http2Parser.php(585): Amp\Http\Server\Driver\Http2Driver->handleShutdown() #3 /home/bob/vendor/amphp/http/src/Http2/Http2Parser.php(209): Amp\Http\Http2\Http2Parser->parseGoAway() #4 /home/bob/vendor/amphp/http-server/src/Driver/H
 
@bwoebi Use the revolt-based branch.
More updates to that branch incoming shortly.
 
@Trowski so … how stable is the revolt API now?
I just don't want to rename things repeatedly just for updates
 
@bwoebi We're going to drop the delay and trapSignal functions. I hope the rest is stable, but I'm not the only one with say in that.
I was going to add delay, etc. functions to the v3-revolt branch on Amp.
 
@Trowski yeah … I want basically something I can actually develop an application with, which I intend to distribute to other people within like 2 weeks
 
There's no way I can guarantee an a stable API in two weeks.
I think updating it would not be difficult though, I don't foresee major changes.
 
2:11 AM
@Trowski in that case it's fine as well
 
@bwoebi Something for work?
 
 
2 hours later…
 
6 hours later…
9:46 AM
Uh, what's the benchmark really saying about the Vector RFC? Is it faster?
 
 
1 hour later…
10:54 AM
@Trowski nope
 
11:33 AM
@Trowski static content, router, session and websocket all don't have revolt based branches … so cannot use them right now
 
 
2 hours later…
2:02 PM
@bwoebi I should be able to have updated versions within the week.
@SaifEddinGmati I swapped the repos around, so feel free to open a PR against the new one anytime.
 
yep, noticed, doing so rn
 
@SaifEddinGmati Great! What do you think of launch instead of defer?
 
@Trowski sounds great
 
@SaifEddinGmati Referring to the standalone function, not the watcher.
 
@Trowski personally i would prefer "queue", because launch sounds like it's launching immediately
 
2:05 PM
Hmm… Loop::queue already exists. I was hoping to pick a unique term. Point taken though.
@SaifEddinGmati I'm not coming up with anything better than queue. I do think I prefer that over defer.
 
What's it do? (i feel like I should know this)
 
defer(callable $call): void, queues the given callable to be executed in a new fiber.
"queue" as in the event loop queue
 
The fiber is not started immediately. It is started when the event loop takes control of execution.
 
2:24 PM
wait / push / next / add, although queue seems to make the most sense.
 
2:44 PM
Is there a chance for PHP8 builds? ・ lua ・ #81459
 
@Trowski yea, that's why i suggested "queue" over "launch"
@MarkR wait is more confusing in async context, reading wait($function) seems like it's going to wait until that function is executed, not sure about the others
@Trowski done :) #1
 
3:01 PM
Renamed it to queue. If someone comes up with a clearly better name we can discuss it, but I think that will do nicely.
@SaifEddinGmati Merged #1 :)
 
The repo is public now, but we won't announce until tomorrow.
 
3:32 PM
@SaifEddinGmati Fair, I get the feeling the difficulty in naming it is that it's not actually operating on the loop, so much as a queue the loop acts on. But maybe I'm missunderstanding.
 
@MarkR The loop is an implementation detail really. A name to convey that the function will be run in a different fiber, where control flow will be separate from that of the current context.
"queue" for execution is still fitting I think.
 
According to the merriam webster dictionary, to fiberize is the process of making a fibre if that's of any use \o/
 
PhpStorm: "Typo: in word 'fiberize'" :( Apparently they don't use that dictionary, lol
JS-style: fiberify
 
Must just be an omission from the dictionary as it's spelt that way on wikipedia, dictionary.com and a bunch of other stuff
 
3:47 PM
Yeah, PhpStorm's dictionary is certainly not comprehensive. Though some unusual words, like promisify, are included.
One can always add to the dictionary, and AFAIK it doesn't highlight things that are defined in dependencies.
 
Tis but a mystery! fiberize certainly seems to describe what it's doing though, does it return a fibre/fibre-like object or does that only get created when the update loop assumes control?
 
@MarkR The fiber is created when the loop assumes control. Nothing is returned from the function. The callable is not suppose to throw. If it does, the exception is forwarded to the loop error handler.
Basically it's creating a green-thread.
Amp (and presumably React) will have a similar function that would return a Promise.
It's not uncommon to wish to start another thread of execution and never await the result, so a version that does not return a promise should also exist.
Amp's future-returning version is called Amp\coroutine() (for the moment at least, lol)
 
It feels like in JS you would always return something and then have a mechanism to chose if you want to wait on it or not e.g. awaiting on a promise or just throwing the var away
 
Potentially. There is some concern people would forgot to do anything with the promise and unintentionally ignore errors.
JS will push unhandled errors to console.log, and we could push them to the loop error handler. The question is when?
 
what are the options?
 
4:05 PM
1) When the promise is failed and there are no callbacks attached. 2) when the promise is destroyed and no callbacks were invoked. Either of those can be annoying when you intentionally don't care if an op fails, e.g. writing to a client that then disconnects, the write fails, but your app doesn't really care about that, say in a websocket server.
That may mean we shouldn't be returning promises from those ops. Not sure.
 
is the expectation that people would care by default, or not care by default?
 
In the context of fibers, things that still return promises do so because we assume you generally will not want to await the op, so not care by default. The exception to that is the promise returned from Amp\coroutine. In that case you should care.
Which is why I prefer two functions to represent caring and not. If one uses the version that returns a promise, it should be an obvious mistake to not await that promise eventually.
 
So may not want to await, is there an API surface for state for example? Such as as knowing if the promise has started, is working, completed. I seem to remember something in the fibre RFC about fibre state, but not a not-yet-created state
 
Promise objects are similar to JS. Only state is resolved or not. Resolves to a value or throws.
Amp\coroutine is a bit like marking a function in JS with async. It just means you'll get a promise out of it instead of the return value directly.
The Fiber object is the mechanism by which the promise is resolved, not unlike the Generator object used in Amp v2.
@MarkR Future in Amp v3. Only methods are isComplete() and await().
 
4:23 PM
I frequently use async functions where I don't care about the response value and only want the ability to await within them, typically in response to UI events where I want to open a dialog, wait for a user to enter something into it, await on an ajax call afterwards etc.
You'll probably find some examples in some of the React code where the event handler looks something like: onClick={() => { dialog.doSomethingAsync(); }}
imgur.com/a/kvvRpHV phpstorm notifies me if i do though
 
But as a notice, not an error, right?
 
Yup, catching any errors is done within the addGrant, but the promise itself is immediately discarded. If I wanted the dialog to stay open if there was a problem saving the identity I could await on addGrant and have it return false, which is how certain dialogs work
 
I think in React when an async function gets called as an event handler, React then attaches a catch handler to the promise that forwards to console.log. Not 100% sure though.
No, I guess that happens for all rejected promises: developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/…
 
4:38 PM
So one of your options is to do similar to having an unhandledRejection on the event loop?
 
Yes, there's already an exception handler for exceptions thrown from watcher callbacks, so unhandled promise exceptions could be forwarded to the same handler.
 
4:54 PM
@MarkR Let's give it a go. :) github.com/amphp/amp/commit/…
Hopefully that doesn't cause too much trouble. I'm a bit concerned about http-server and websocket-server.
Another method like Future::ignoreError() would solve that nicely though.
 
 
6 hours later…
10:52 PM
just a live bug test ・ Website problem ・ #81460
 

« first day (3991 days earlier)      last day (940 days later) »