Answer the question
In order to leave comments, you need to log in
Generating async code from normal, if there is a way?
I want, for example, to write a WS server. Keeping a process per connection is not very good, so things like this should be done asynchronously. Writing asynchronous code is a bit more tedious than regular linear code, and I want to be able to write code as usual, but for the preprocessor to already convert it to async.
# Т.е. обычно, к примеру, пишу
my $result = ask_database('query');
# когда тоже самое, но асинхронно:
ask_database('query', sub {
my $result = shift;
});
// Из этого
console.info('test1');
hypothetic_sleep(1000);
console.info('test2');
// Автоматически бы делалось это
console.info('test1');
setTimeout(function() {
console.info('test2');
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question