SWI-Prolog / packages-pengines

Pengines: Prolog engines
11 stars 13 forks source link

Nested `pengine_ask`s mix up queries and results #27

Closed bopjesvla closed 7 years ago

bopjesvla commented 7 years ago
http_get([host(localhost), port(5000), path('/pengine/send'), search([format='json',id=Id,event='ask((
  pengine_self(Id2),
  pengine_ask(Id2, true, [])
),[])'])], json(X), []),
http_get([host(localhost), port(5000), path('/pengine/send'), search([format='json',id=Id,event='ask((
  X = 1
),[])'])], json(Y), []),
writeln(Y)

Results in

[data=[@true],event=success,id=c41dc54c-82cb-4191-918f-aa5d0e060528,more= @false,projection=[X],time=1.782200000000002e-5]

As you can see, the response to the second request is the first nested query.

bopjesvla commented 7 years ago

To be clear, if the first request is not made:

% first request removed
http_get([host(localhost), port(5000), path('/pengine/send'), search([format='json',id=Id,event='ask((
  X = 1
),[])'])], json(Y), []),
writeln(Y)

The correct result is returned:

[data=[json([X=1])], ...]
bopjesvla commented 7 years ago

Never mind, nested pengine_asks wouldn't work anyway, since they are executed synchronously.