There is also problem that the stackoverflow doesn’t get reported. Usually
SWI-Prolog doesn’t abort silently. I guess it would also happen for (:-)/2 rules,
independent from (=>)/2, since it happens inside the meta-interpreter.
I thought that the intent was to raise an exception if reverse/2 has an uninstantiated first argument. If you want to handle an uninstantiated first argument (although I don’t know why this would be wanted), you could just wrap reverse/4 with a freeze/2 or when/2.
X = [2, 1].
?- reverse(X,Y), X = [1,2].
X = [1, 2],
Y = [2, 1] .
Doesn’t work anymore with single sided unification. But there are possibly better examples for steadfastness. Generally when we view exceptions as type errors, then a logical variable is not yet a type error, since it can be instantiated with the right type in the future.
So passing a logical variable to reverse shouldn’t be an error, while passing an atom a is an error, since the type of reverse/2 first argument is intended to be a list. But a logical variable can be anything also a list, so throwing an error for a logical variable is somehow unsound.
ERROR: No rule matches reverse(_2624,,_2628,_2628)
Since it doesn’t commit prematurely to some failure!!!
We might start a new thread “Failure considered harmful”,
but we are not in the mood to channel our inner Niklaus Wirth.
The original title of the letter, as submitted to CACM, was “A Case Against the Goto Statement”, but CACM editor Niklaus Wirth changed the title to “Go To Statement Considered Harmful”. Frank Rubin published a criticism of Dijkstra’s letter in the March 1987 CACM where it appeared under the title “‘GOTO Considered Harmful’ Considered Harmful”. Considered harmful - Wikipedia
So maybe the new thread should have title
“Error Considered Harmful’ Considered Harmful”.