Open UWN opened 2 years ago
?- format("~w\n",[X]). A % unexpected, expected: start with _, as below true. ?- write(X),nl. _1450236 % expected, a bit verbose though true.
~w should write a term using write/1. ~q should writeq it.
In above case both should use a2 for writing out a variable. Thus starting with an underscore and then some implementation dependent sequence.
It has been like that since the inception of format/2 and even in its predecessor writef/2. That is at least 1981.
This is due to write_term_to_chars/3:
write_term_to_chars/3
?- use_module(library(charsio)). true. ?- write_term_to_chars(X, [], Chars). Chars = "A".
~w should write a term using write/1. ~q should writeq it.
In above case both should use a2 for writing out a variable. Thus starting with an underscore and then some implementation dependent sequence.
It has been like that since the inception of format/2 and even in its predecessor writef/2. That is at least 1981.