Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pengines_io goal expansion example is not working #36

Open
triska opened this issue May 14, 2018 · 1 comment
Open

pengines_io goal expansion example is not working #36

triska opened this issue May 14, 2018 · 1 comment

Comments

@triska
Copy link
Member

triska commented May 14, 2018

I try to construct a small working example from the documentation of pengines_io.

So I create ma.pl with the following content:

:- module(ma, []).

:- use_module(library(pengines)).


:- pengine_application(myapp).
:- use_module(myapp:library(pengines_io)).
myapp:goal_expansion(In,Out) :-
        pengine_io_goal_expansion(In, Out).


pred :-
        format("hello!\n", []).

The bold part is directly copied from the library documentation.

Now, I get:

?- listing(pred).
ma:pred :-
	format("hello!\n", []).

However, when I change the bold part to (change in bold: myappma):

:- pengine_application(myapp).
:- use_module(myapp:library(pengines_io)).
ma:goal_expansion(In,Out) :-
        pengine_io_goal_expansion(In, Out).

then I get the expected expansion:

?- listing(pred).
ma:pred :-
	pengine_format("hello!\n", []).

Please check the example in the documentation, and whether it is working as intended. Thank you!

@JanWielemaker
Copy link
Member

This is to be expected. ma is does not inherit from the Pengine application module. The intended scenario is that the pengine application module defines the Pengine application settings and default environment. If you create a Pengine the library creates a temporary module that inherits from the application. This makes the predicates from the application visible as fall-back (you can overrule them). This also holds for goal/term expansion and operators.

Not sure how to fix that in the docs. Apparently It is not clear. If you think you now understand what is going on and you see a better formulation, please submit a pull request on the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants