to load the same prolog file into different modules in jpl -
i trying use jpl load same swipl file different modules. reason had because want have module can assert new predicates to, while leave other untouched. problem swipl seems forbidding this,
jpl.prologexception: prologexception: error(permission_error(load, source, 'load.pro'), context(/(load_files, 2), 'non-module file loaded module stable; trying load to_mess')) @ jpl.query.get1(query.java:336) @ jpl.query.hasmoresolutions(query.java:258) @ jpl.query.onesolution(query.java:688) @ jpl.query.hassolution(query.java:759)
i have tried set redefine_module(true) load_files, still no go
val query = new query(s"load_files(${m}:'${loader}', [redefine_module(true)])") query.allsolutions()
i have been blocked hours, cannot find solution online. can please help??
you can use logtalk running on swi-prolog + jpl accomplish having 2 encapsulation units (objects instead of modules in case) sharing common initial definition (the contents of file you're trying load in 2 or more different modules). details of using logtalk + swi-prolog + jpl see example:
https://github.com/logtalkdotorg/logtalk3/wiki/using-logtalk-with-jpl
for code sharing implied in question, 1 solution put contents of file in object , derive (using inheritance) many object needed. more specific advice need more details on you're trying accomplish.
Comments
Post a Comment