David_West%UB-MTS%UMich-MTS.MAILNET@MIT-MULTICS.ARPA (10/15/86)
Most criticisms of Turbo Prolog have been only flames, but the
following is, I think, an actual bug. If member is defined by:
member(H,[H|_]):-!.
member(H,[_|T]):-member(H,T).
the goal:
member([1,X],[[3,4],[1,2]]).
will succeed (binding X to 2) or FAIL if the domain of the
lowest level list elements is declared as integer or reference
integer, respectively.
It might be argued that this choice (whether or not to specify
reference) is the user's responsibility, as in Algol-like
languages; My view is that reference declarations are (like
register declarations in C) "advice to the compiler", which
should not alter the semantics of the program . This seems
reasonable because:
1) the Turbo Prolog compiler will on its own initiative retype
domains from value to reference, so it can't consider
the distinction to affect the semantics; and
2) the abovementioned goal fails ONLY if the cut is present
in the first clause of member; without this cut, Turbo
Prolog (with or without reference specified) gives the same
result as do other Prologs (for which, as expected, the
presence or absence of the cut does not affect the result).