It only allows other tasks to run, which are put on the task
queue by the browser, like mouse evens and screen refresh.
But not some Prolog tasks. You have one task who waits
the fetch to be finish. What are the other Prolog tasks. So I
wondern how serious these claims are, namely this here:
But import() on the other hand can do multi-tasking concerning
loading. I didn’t try yet, and I also don’t know how to invoke
it via the functional form. Did some Australian guy demonstrate
it recently for Eyebrow? The script tag has various options:
For module scripts, if the async
attribute is present then the scripts and all their dependencies
will be executed in the defer queue, therefore they will get
fetched in parallel to parsing and evaluated as soon
as they are available.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
So basically without engines, one could possibly have,
these Prolog texts foo.p, bar.p and baz.p consultet in parallel.
Similar like Isabelle/HOL has a parallel loader:
/* Multi-Consult Can it be made Parallel */
?- ['foo.p', 'bar.p', 'baz.p'].
Loaded in parallel, when delegating to JavaScript import(). So
parallel loading is adressed by JavaScript without invoking ideas
of a multi-tasking environment or engine for the application.
Maybe some key idea is chunking. Not sure. It could be also that
different browser engines or browser engine versions offer different
solution. Probably only needed when you have slow but nevertheless
parallel internet connection. i.e. enough bandwidth to yeet multiple requests.
Edit 06.10.2022
Possibly this works also with fetch, if you combine multiple promisses
via Promise.all() or some such. But fetch() is only one half of consult, it
only fetches the text data. It doesn’t add the data to the knowledge base.
On the other hand a JavaScript code, when the import() does also some
evaluate, can possibly do both. Namely fetch the text data, and add the
data to the knowledge base. Bringing data to the client in a parallel fashion
ist most likely what import() allows. Didn’t try yet. Maybe use this syntax
for parallel import. A list wrapped into a singleton list. Or use some flag
to control it, since a default parallel behaviour could be too dangerous?
/* Parallel Variant Syntax of Multi-Consult ? */
?- [['foo.p', 'bar.p', 'baz.p']].
Of course engines or what Tau Prolog did with tasks and promises, could
also lead to a parallel load. Maybe can get away with a cheaper solution,
not bring tasks to Dogelog player, only juggle with import() ?