Error[XSB/Runtime/P]: [Type (library(http / thread_httpd) in place of atom)]

108 Views Asked by At

I am trying to host XSB in a server. I wrote the following code:

:- module(server, [server/0, server/1]).
:- import http_server/2 from library(http/thread_httpd).
:- import http_dispatch/1 from library(http/http_dispatch).
:- use_module(swish, []).

server :-
    server(localhost:3050).

server(Port) :-
    http_server(http_dispatch,
            [ port(Port),
              workers(16)
            ]).

I am getting the following error

    [xsb_configuration loaded]
    [sysinitrc loaded]
    [xsbbrat loaded]
    [Compiling ./server]
    ++Warning[XSB]: [Compiler] ./server : Unused symbol http_dispatch/1
    ++Warning[XSB]: [Compiler] ./server : Unused symbol swish/0
    ++Warning[XSB]: [Compiler] ./server : Unused symbol library(http / http_dispatch)/0
    ++Error[XSB/Runtime/P]: [Type (library(http / thread_httpd) in place of atom)] in arg 1 of predicate atom_length/2
    Forward Continuation...
    ... asmpass2:asm_putsym/2

Can someone please tell me what I doing wrong here. Your help is greatly appreciated.

1

There are 1 best solutions below

0
On

You cannot use SWI-Prolog HTTP libraries with XSB. Those libraries rely on SWI-Prolog proprietary features and will not work as-is in XSB. Porting the libraries is not a trivial task either, starting with the fact the module system in SWI-Prolog is predicate-based while the module system in XSB is atom-based.