I am using swipl version 8.1.26 under Windows, MacOS, and openSUSE Linux.
I have written a Prolog application that reads my students’ programs, performs some tests on the programs, and gives feedback.
As the students shall use my application locally without internet access on their own laptops (i.e. under Windows, MacOS, or Linux) and without seeing my application’s source code, I compiled my code under Windows, MacOS, and openSUSE Linux and distributed the compiled code to the students.
Some students use my application to check their own student program which is correct, but contains a singleton variable.
Unfortunately, then my compiled application hangs, when it was compiled and is executed under Windows (but not when compiled and executed under MacOS or Linux).
I could boil down this hanging behaviour to the following 5 lines of code.
% This is my application f.pl
% Purpose: read StudentFile s.pl, perform tests, and give automated feedback on s.pl
main(Argv) :-
append(_,[StudentFile],Argv), % read name of student's file
[StudentFile], % load file that may have singleton variables
true. % perform tests on StudentFile and give feedback (omitted here)
This is a student file causing my application to hang:
% StudentFile s.pl:
sentence([Subj,A,N,_]) --> [Subj,N] , ['.'] . % contains singleton variable A
% further details of student file omitted here
This is how I compiled my application under Windows:
Windows> swipl --goal=main -o h -c f.pl <-- this compiles
This is what the students do locally to test their program s.pl:
Windows> h s <-- this HANGS after giving the singleton variable warning
I would prefer that my application would NOT hang on the student’s Windows laptops, but do the tests (line 4 of my application).
This works well under MacOS (or Linux), i.e., after giving the singleton warning, my application does NOT hang, but performs the tests (line 4 of my application) on the student’s MacOS laptops:
This is how I compile my application on Mac OS:
MacOS> swipl --goal=main -o h -c f.pl <-- this compiles
This is what the students do locally to test their program s.pl
MacOS> ./h s <-- this TERMINATES after the singleton variable warning
If I compile my application under openSUSE Linux, and the students run the compile application under openSUSE Linux, it tworks fine, i.e. exactly as under MacOS.
I would prefer that my application, when compiled and running under Window also works like it does under MacOS, i.e., does not hang.