Open torbjornlager opened 10 years ago
This note mostly concerns the demo platform, but could perhaps serve as an argument for implementing the proposal. If we can find a way to make URLs in the code editor clickable (shouldn't be hard, see e.g. http://jsbin.com/jehopaja/4/edit) we could decide to show a nice overview of the corresponding application module, including (a link to) an editor that those that are authorised can use in order to edit the module. For unauthorised users, this editor will (subject to a setting) be set to read only.
This is how we can support the creation of local pengines:
pengine_create([
server('/bar')
])
Perhaps server('/pengine_sandbox') can be the default so that it can be left out in a case like this?:
pengine_create([
server('/pengine_sandbox')
])
Ok, if a URL is meaningless in the context of of a local pengine, maybe we can use a URI or a URN?
See: http://en.wikipedia.org/wiki/Uniform_resource_identifier
I'd discourage enforced placing of the application name in the URI path segment. There are often other considerations with the path name. For example, sometimes one is serving on 80 sharing a domain with other non prolog services, and apache is fronting, only redirecting a portion of the URI path space (see http:prefix/1 for example). better is to just associate an URI (domain + path) with an application arbitrarily by some setting. Adopting the pervasive 'abstract location' mechanism might be good. An URL is indeed different from an URI. An URL is a location, an URI is a name. But that's fine - http://swi-prolog.org/ is both the URL for the SWI-Prolog site and the URI for the home page. The server should know the application based on the endpoint.
I have a suggestion for improving the design of Pengines. It concerns the notion of a pengine *application". As things now stand we pass the name of an application to (say) pengine_rpc/3 as an option, for example:
?- pengine_rpc('http://pengines.swi-prolog.org', foo(X), [application(bar)]).
I propose that we pass the name of the application in the URL instead. If we did, the above example would be written as:
?- pengine_rpc('http://pengines.swi-prolog.org/bar', foo(X)).
It may seem that we would lose the flexibily of being able to do
?- App=bar, pengine_rpc('http://pengines.swi-prolog.org', foo(X), [application(App)]).
but that can be fixed by instead allowing
?- App=bar, pengine_rpc('http://pengines.swi-prolog.org/'+App, foo(X)).
The advantage will be mostly one of elegance, because now the URL in the first argument of pengine_rpc/3 refers to a Prolog program (or module). This isn't the case in the current design where it serves as the host name of a Pengines server.