a) The relationship between the :-uses/2 and :-logtalk_load directives
b) Whether the aliases created by :-uses are inherited down the instantiation and specialization hierarchies
c) The Linter warnings about unknown objects on the :-uses lines
Assuming that the answer to b) is yes, I have created the following meta-circular metacclass object:
Code: Select all
1 :- object(metaclass, instantiates(metaclass)). 2 :- use_module(clpfd, [ 3 op(760, yfx, #<==>), op(730, yfx, #\), op(720, yfx, #/\), 4 op(700, xfx, #=), op(700, xfx, ins), op(450, xfx, ..), 5 (#<==>)/2, (#/\)/2, (#\)/2, (in)/2, (#=)/2, labeling/2 6 ]). 7 :- uses(list, [append/3, member/2]). 8 :- uses(loop, [foreach/3]). 9 :- public(new/2). 10 new(Instance, Clauses) :- self(Class), create_object(Instance, [instantiates(Class)], , Clauses). 11:- end_object.
My loader file loader.lgt is:
Code: Select all
1 :- ensure_loaded(library(clpfd)). 2 :- initialization(( 3 logtalk_load(loops(loader)), 4 % logtalk_load(basic_types(loader)), 5 % logtalk_load([listp, list]), 6 logtalk_load(types(loader)), 7 logtalk_load(refasModel) 8 )). 9 %:- initialization(logtalk_load([loops(loader), types(loader), refasModel])).
refasModel.lgt:7: Warning: Reference to unknown object: list
If I comment line 7 out, the warning then becomes:
refasModel.lgt:8: Warning: Reference to unknown object: loop
If I in turn comment line 8 out, the warning then becomes:
refasModel.lgt:2: Warning: Reference to unknown module: clpfd
I have tried to change the loading of the list object with commented out lines 4, 5 and 6 in my loader.lgt file, to no avail.
This behavior of the Linter, first cascading warnings down and then up the file is more confusing than helpful to a newb like me and the existing threads on "reference to unknown object" in this forum seem to address complex cross-referencing dynamic loading files and hence unrelated to my trivial toy problem.
How to correctly load and use the Logtalk libraries. ?