|
From: | Sean Charles |
Subject: | Conditional includes... |
Date: | Sat, 9 Nov 2013 22:30:58 +0000 |
I am having troubles with files being included more than once and I don’t seem to be able to code my away around it! In my utils.pl file I have a predicate called now_string() and I have application code and test scripts that use it and now, after refactoring, my test scripts break because none of the files under test are pulling it in… I removed it from one file because that file was being included in another file yadda yadda yadaa you know how these things get from time to time. I thought I could put in a test like this: :-if( \+ current_predicate(utils_included)). :-include('utils.pl'). :-endif. But it won’t play ball. In the utils.pl file the first fact is “utils_included.” I hope you get the picture, problem is, gprolog doesn’t! compiling /Users/seancharles/Documents/FELT/felt-prolog/feltlexer.pl for byte code... /Users/seancharles/Documents/FELT/felt-prolog/feltlexer.pl:38:1: syntax error: . or operator expected after _expression_ /Users/seancharles/Documents/FELT/felt-prolog/feltlexer.pl:39: fatal error: unexpected endif directive Is there an “accepted technique” for handling file included in Prolog applications to avoid multiple definitions and things? Thanks, Sean. |
[Prev in Thread] | Current Thread | [Next in Thread] |