swipl-devel icon indicating copy to clipboard operation
swipl-devel copied to clipboard

Minor: Confusing message when one calls goal `type_error(_,_)`

Open dtonhofer opened this issue 3 years ago • 0 comments

?- type_error(_,_).
ERROR: Type error: `_5508' contains attributed variables
ERROR: In:
ERROR:   [11] throw(error(type_error(_5562,_5564),_5558))
ERROR:    [9] toplevel_call(user:user: ...) at /usr/local/logic/swipl/lib/swipl/boot/toplevel.pl:1115
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.

This is because the first unifying head / matching clause in boot/messages.pl is:

iso_message(type_error(free_of_attvar, Actual)) -->
    [ 'Type error: `~W'' contains attributed variables'-
      [Actual,[portray(true), attributes(portray)]] ].

Yup, it matches, after a fashion.

My contention that Prolog absolutely needs a way to indicate "this argument shall not unify with an unbound variable" in the head, without having to uglify the code, holds.

dtonhofer avatar Jun 07 '21 18:06 dtonhofer