Hi Klāvs,
Your feedback is welcome!
for async $i in 1 to 10 return fetch:text("http://example.com/magic-story/for-number/" || $i)
Problem here is that you need to introduce a new keyword to the language. I am just trying to figure out if there could be a solution like this.
That’s true (and the keyword wouldn’t change the result at all). One alternative could be to use a pragma. The following query is valid XQuery 1.0:
declare namespace basex = 'http://basex.org'; for $i in (#basex:async #) { 1 to 10 } return $i * 2
for $i in 1 to 10 return fetch:text-with-implicit-parallel-execution-characteristics("http://example.com/magic-story/for-number/" || $i)
The pragma could also be attached to the return expression, but in many cases (in particular after function inlining), FLWOR expressions can get pretty complex, and it would be a non-trivial task to choose the best for clause for parallelization.
Christian