Currently Promise type annotations and awaiting them does work. But that is it
One thing currently stuck on is how to represent the flow in a async situation
async function func(something: Promise<T>) -> Promise<[T]> {
const x = await new Promise((res, rej) => res(2));
// this returns when `res` is called
await new Promise((res, rej) => setTimeout(res, 1000));
// this runs when setTimeout calls res
const y = await something;
return [y]
}
let x = 0;
async function immediate() {
x = 1
}
x satisfies 0;
immediate(); // (btw await has no effect here, unlike Rust)
x satisfies 1
/// On the other hand
let x = 0;
const wait = new Promise((res, rej) => {
setTimeout(res, 1000);
}).then((_) => {
x = 1;
});
x satisfies 0;
await wait; // Does have an effect. If not `await`, then the next == 0
x satisfies 1;
Thinking
- What happens in
Event::Await ???
- Could there be
Event::WaitsToFunctionToBeCalled ???
- How to represent non-immediate function calls
- This partially exists via
CallingTiming
- Getters need to be called under functions that are not
FunctionEffect::SideEffects (separate issue and not currently implemented)
- Maybe more information sent in decorators
- What happens for conditional
await branches
- This seems really difficult for unknown-ness. Trailing events need to be run somewhat synchronously and non-synchronously
- ...
Additionally
- Calling
then-ables
async functions returns should return a Promise<...>
- Checking whether
await is valid in some place
- Warn if
await has no effect
Currently
Promisetype annotations andawaiting them does work. But that is itOne thing currently stuck on is how to represent the flow in a async situation
Thinking
Event::Await???Event::WaitsToFunctionToBeCalled???CallingTimingFunctionEffect::SideEffects(separate issue and not currently implemented)awaitbranchesAdditionally
then-ablesasyncfunctions returns should return aPromise<...>awaitis valid in some placeawaithas no effect