Sami Vaarala
Sami Vaarala
Coming back to concrete issues - were you thinking that a hypothetical C API would need to throw if the callstack wasn't empty? I think it'd be good if the...
By C API I mean a Duktape C API call that would be used to process the pending events in the job queue.
I agree - ideally it would throw when there's actual application code on the call stack (which means all bets are off re: Promise behavior) but until that distinction is...
Here's an example API that might be workable from C code: ``` c /* Enable job queue for a global environment. Before this is called, any attempt * to register...
Another design for `duk_process_job()` would make it an automatically protected call and it would then return: - A success/error indication - A potential error on the value stack - A...
Regarding implementation it'd probably be good to add generic support for a job queue into the C API first, and then implement Promises on top of that. As discussed above,...
Right, user jobs would be just another type. I'm not sure if it makes sense to try to differentiate the jobs or manage different job queues, at least as a...
That would work well too, and can also be resized in-place. The minimal unshift approach doesn't need any index state or such, so you just operate on the array. Anything...
Or we can get crafty and put control properties at the beginning of the array object (e.g. at index 0).
Actually if one wanted to really minimize the number of objects allocated, a single array would do it: one would append the jobs of the form: nargs, function, this, arg1,...