By playing around I found out that already the unification of a variable can cause the error when inside of a term a field dereference of a dict takes place.
X.crash() := VALUE :- true
, aggregate_all( sum( M.value ), member( M, X.values), VALUE)
.
X.workaround() := VALUE :- true
, findall( V, ( member( M, X.values), V=M.value), VALUES)
, aggregate_all( sum( M ), member( M, VALUES), VALUE)
.
X.freezes() := VALUE :- true
, C= aggregate_all( sum( M.value ), member( M, X.values), VALUE)
, C
.
X.crash2() := VALUE :- true
, TERM = ( member( M, X.values), V=M.value)
% , findall( V, TERM, VALUES)
% , VALUE=VALUES
, VALUE=1
% , aggregate_all( sum( M ), member( M, VALUES), VALUE)
% , aggregate_all( sum( V ), TERM, VALUE)
.
X.crash3() := VALUE :- true
, XVALUES= X.values
, TERM = ( member( M, XVALUES), V=M.value)
% , findall( V, TERM, VALUES)
, VALUE=1
% , aggregate_all( sum( M ), member( M, VALUES), VALUE)
% , aggregate_all( sum( V ), TERM, VALUE)
.
test001 :- true
, VALUE = x{values:[p{value:1},p{value:2}]}.crash()
, writeln(VALUE)
.
test002 :- true
, VALUE = x{values:[p{value:1},p{value:2}]}.workaround()
, writeln(VALUE)
.
test003 :- true
, VALUE = x{values:[p{value:1},p{value:2}]}.freezes()
, writeln(VALUE)
.
test004 :- true
, VALUE = x{values:[p{value:1},p{value:2}]}.crash2()
, writeln(VALUE)
.
test005 :- true
, VALUE = x{values:[p{value:1},p{value:2}]}.crash3()
, writeln(VALUE)
.
output:
(ins)?- test003. % freezes for a moment and has no output
(ins)?- test004.
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [16] throw(error(instantiation_error,_1984))
ERROR: [13] crash2(x{values:[...|...]},_2010) at /home/ox/dev-git/go/endgame-subgames-calculation/003_bug_report.pl:16
ERROR: [12] eval_dict_function(crash2(),x,x{values:[...|...]},_2054) at /usr/local/lib/swipl/boot/dicts.pl:102
ERROR: [10] test004 at /home/ox/dev-git/go/endgame-subgames-calculation/003_bug_report.pl:58
ERROR: [9] toplevel_call(user:user:test004) at /usr/local/lib/swipl/boot/toplevel.pl:1117
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
(ins)?- test005.
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [16] throw(error(instantiation_error,_10796))
ERROR: [13] crash3(x{values:[...|...]},_10822) at /home/ox/dev-git/go/endgame-subgames-calculation/003_bug_report.pl:29
ERROR: [12] eval_dict_function(crash3(),x,x{values:[...|...]},_10866) at /usr/local/lib/swipl/boot/dicts.pl:102
ERROR: [10] test005 at /home/ox/dev-git/go/endgame-subgames-calculation/003_bug_report.pl:63
ERROR: [9] toplevel_call(user:user:test005) at /usr/local/lib/swipl/boot/toplevel.pl:1117
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
Regards,
Frank