Re: strange problem with use_module
db <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Hello Yan,
Sorry for the lack of details, so here is a
very simple example which run
under Swi-prolog 64 bits, Version 6.6.1
(on ubuntu 12.04)
(the same problem appears with swi 7)
Consider 3 swi-prolog program,
test_module.pl, module1.pl and module2.pl
with :
test_module.pl
=====================================
my_goal :-
gtrace,
use_module('module1.pl').
=====================================
module1.pl
====================================
:- module(module1, []).
:- use_module('module2.pl').
====================================
module2.pl
====================================
:- module(module2, []).
====================================
Now if you consult test_module.pl
and execute :
?- my_goal.
this lauches the graphical debugger.
If you use the right arrow (->) to enter in the goal
use_module('module1.pl'), you obtain :
system:'$expand_term'(A, B, C, D) :-
expand_term(A, B, C, D).
with :
A = :-module(module1, [])
B = term_position(0, 22, 0, 2, [term_position(3, 22, 3, 9, [10-17, 19-21])])
When you continue to click on the right arrow (->)
this finally fails with the error message :
ERROR: Domain error: `module_file' expected, found
`/home/dominique/Bureau/Lea1_work/module1.pl'
BUT :
If you restart from scratch (quit prolog, consult and execute my_goal).
You again obtain the window of the graphical debugger.
if you use the arrow SKIP OVER (the third one from the left),
the goal succeeds.
Why ?
Thanks a lot if you have any explanation.
Cheers.
Dominique
Le 03/03/2014 09:14, Jan Wielemaker a écrit :
> You make us guess what you are doing. From `go into',
> I have the impression that you use use_module/1 as a
> normal goal inside a program to load code dynamically,
> right?
>
> I could imagine that this might lead to some mixup in the
> source handling, but a simple test shows everything works
> just fine.
>
> For short, as usual we need a complete example and instructions
> how to make it fail ...
>
> As a work-around, it might be wise to use 's' (skip) on the
> use_module/1 call. Except for the execution of some hooks,
> nothing should be visible anyway and there is surely nothing
> you can debug with the gui tracer.
>
> Cheers --- Jan
>
>>
>> Dominique
>>
>>
>> Le 02/03/2014 22:16, db a écrit :
>>> Hi Jeff,
>>>
>>> I have tried your solution but there is still
>>> the same problem :
>>>
>>> the instruction
>>> use_module(my_module) (without the extension .pl)
>>> works without the graphical debugger
>>> and does not work with it.
>>>
>>> Thanks for your answer.
>>>
>>> Regards
>>> Dominique
>>>
>>>
>>> Le 02/03/2014 19:48, Jeff Rosenwald a écrit :
>>>> Hi Dominique:
>>>>
>>>> It doesn't work at all on the Linux distro of SWIPL.
>>>>
>>>> Please try: "use_module(my_module)." That is, omit the extension and see
>>>> if that changes the symptom.
>>>>
>>>> Regards,
>>>> Jeff R.
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: db <[email protected]>
>>>> To: swi-prolog <[email protected]>
>>>> Sent: Sun, Mar 2, 2014 12:01 pm
>>>> Subject: [SWIPL] strange problem with use_module
>>>>
>>>> Hello,
>>>>
>>>> I use SWI-Prolog (Multi-threaded, 64 bits, Version 7.1.9)
>>>> on Ubuntu 12.04.
>>>>
>>>> In a program I have the instruction :
>>>>
>>>> use_module('my_module.pl').
>>>>
>>>> It works if I do not use the graphical debugger.
>>>>
>>>> But when I use the graphical debugger (with gtrace),
>>>> I obtain the following error :
>>>>
>>>> ERROR: /home/Dominique/create_int_examples.pl:49: Initialization goal
>>>> raised exception:
>>>> ERROR: Domain error: `module_file' expected, found
>>>> `/home/dominique/Documents/Recherche/completion2.pl'
>>>>
>>>> Anyone would have an explanation ?
>>>>
>>>> Thanks a lot
>>>>
>>>> Dominique
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> SWI-Prolog mailing list
>>>> [email protected]
>>>> <mailto:[email protected]>
>>>> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>>>>
>>>>
>>> _______________________________________________
>>> SWI-Prolog mailing list
>>> [email protected]
>>> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>>>
>>>
>>>
>> _______________________________________________
>> SWI-Prolog mailing list
>> [email protected]
>> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>
> !DSPAM:152,53143a32267468267011239!
>