Here is like what I have
%% this is file foo.lgt
:- object(foo) .
%% some predicates/facts
:- end_object .
%% this is file bar.lgt
:- object(bar) .
%% some predicates/facts
:- end_object .
%% this is file load.lgt
:- initialization(logtalk_load(['foo', 'bar'])) .
Let's say I have loaded load.lgt with
?- logtalk_load('load') .
I have made some changes to both load.lgt and foo.lgt, if I run
?- logtalk_load('load')
again, then both foo.lgt and load.lgt will be reloaded. However if only foo.lgt has some changes made, running logtalk_load('load.lgt') will not trigger any reload. Is there a way to reload a modified file which is loaded through a "loader".
I am using logtalk3, so reload flag is not an option.
"logtalk_load" to reload files with changes
Moderator: Paulo Moura
-
- Logtalk developer
- Posts: 488
- Joined: Sat May 05, 2007 8:35 am
- Location: Portugal
- Contact:
Re: "logtalk_load" to reload files with changes
Assuming that you're using Logtalk 3.00.0 Alpha 21 or later, simply use the logtalk_make/0 built-in predicate for reloading source files modified since the last time they are loaded:
There is also a short alias for this predicate, {}/0, so you can also type:
Your loader file is not the one being changed, so Logtalk knows that's up-to-date. Not sure what would be the best solution here as loader files are just normal source files that happen to load other files. One option would be to reintroduce something like the old "reload" flag to mark files that should always be reload. On POSIX systems, typing:
would also work but it cumbersome.
Code: Select all
| ?- logtalk_make.
Code: Select all
| ?- {}.
Code: Select all
$ touch loader.lgt
Paulo Moura
Logtalk developer
Logtalk developer
Re: "logtalk_load" to reload files with changes
This is what I figured too, which is indeed awkward 
Curious of why logtalk 3 got rid of reload flag...?

Code: Select all
:- initialization((
shell('touch load.lgt'),
logtalk_load('load')
)) .
Paulo Moura wrote:Assuming that you're using Logtalk 3.00.0 Alpha 21 or later, simply use the logtalk_make/0 built-in predicate for reloading source files modified since the last time they are loaded:
There is also a short alias for this predicate, {}/0, so you can also type:Code: Select all
| ?- logtalk_make.
Your loader file is not the one being changed, so Logtalk knows that's up-to-date. Not sure what would be the best solution here as loader files are just normal source files that happen to load other files. One option would be to reintroduce something like the old "reload" flag to mark files that should always be reload. On POSIX systems, typing:Code: Select all
| ?- {}.
would also work but it cumbersome.Code: Select all
$ touch loader.lgt
-
- Logtalk developer
- Posts: 488
- Joined: Sat May 05, 2007 8:35 am
- Location: Portugal
- Contact:
Re: "logtalk_load" to reload files with changes
Note that if you're using SWI-Prolog as the back-end compiler for Logtalk, you can also simply type "make" to reload both modified Logtalk and Prolog source files.
Paulo Moura
Logtalk developer
Logtalk developer
Re: "logtalk_load" to reload files with changes
I am kinda reluctant to use make/0, this along with listing/0 sometimes would cause jvm crash through jpl...
Paulo Moura wrote:Note that if you're using SWI-Prolog as the back-end compiler for Logtalk, you can also simply type "make" to reload both modified Logtalk and Prolog source files.
-
- Logtalk developer
- Posts: 488
- Joined: Sat May 05, 2007 8:35 am
- Location: Portugal
- Contact:
Re: "logtalk_load" to reload files with changes
I'm only suggesting SWI-Prolog make/0 or Logtalk logtalk_make/0 during development, when editing your source files. I also would not try it via JPL.shengcer wrote:I am kinda reluctant to use make/0, this along with listing/0 sometimes would cause jvm crash through jpl...
Paulo Moura wrote:Note that if you're using SWI-Prolog as the back-end compiler for Logtalk, you can also simply type "make" to reload both modified Logtalk and Prolog source files.
Paulo Moura
Logtalk developer
Logtalk developer
Who is online
Users browsing this forum: No registered users and 1 guest