diproche / webinterface

1 stars 0 forks source link

Create an asynchronous wrapper around the swipl-wasm-interface #112

Closed Khazuar closed 5 years ago

Khazuar commented 5 years ago

An attempt to make the prolog connection easier to use.

Does not handle multiple results or errors correctly yet.

Khazuar commented 5 years ago

The PR might go into another target branch instead.

TimothyGillespie commented 5 years ago

It surely does help.

One issue I encounter is, that the first test will take to long and time out. This problem has occured with my branch as well. I cannot see why this behavior happens though. I think this is beyond my ability as of now.

It seems that swipl-wasm cannot handle multiple results in general. It will recognize that something is yet to come but I couldn't find a way to get a second result on their example page too. But this wouldn't be necessary for our purpose and could be resolved with the bagof/3 and findall/3 predicates if multiple answers are needed.

Khazuar commented 5 years ago

One issue I encounter is, that the first test will take to long and time out. This problem has occured with my branch as well. I cannot see why this behavior happens though. I think this is beyond my ability as of now.

On your local machine as well or on semaphore only? Locally this works for me. I can only speculate to the reason behind the issue on semaphore:

Either way, this should be fixable with a little more experimenting. I tend to the last explanation, since I see locally that the first test is taking a hundred times longer than the subsequent ones - that's the initial loading of the wasm engine and of SWI.

It seems that swipl-wasm cannot handle multiple results in general. It will recognize that something is yet to come but I couldn't find a way to get a second result on their example page too.

Yes. I tried for multiple hours to figure out how to get the next results out. I found this page in the SWI manuals that describe two ways to work with the Foreign Language Interface of SWI, either by PL_call (which we use right now and which is described in there as simple, but limited) and another one, where you need to call multiple different specialized methods. I didn't try the other one actually.

But this wouldn't be necessary for our purpose and could be resolved with the bagof/3 and findall/3 predicates if multiple answers are needed.

I agree, since we're not running arbitrary queries, and can just work around the issue anyways, the current solution might be just sufficient.