io/format/print-message(<condition>) doesn't work
As said in documentation https://opendylan.org/documentation/library-reference/io/format.html#io:format:print-message([condition]) the method print-message(<condition>) doesn't work.
https://github.com/dylan-lang/opendylan/blob/89e84131706393e255be12a388853191c12b9d46/sources/io/format.dylan#L74-L83
I wonder what the problem is with report-condition....
report-condition(object, stream) is not a thing; it's report-condition(condition) => (). The only way that could be useful is if all errors are reported to *standard-error* or something like that, which is completely inadequate. Which is to say that I'm not sure what the comment above means. Also they don't say how it's broken.
My current problem: I signal a subclass of <format-string-condition> with format-arguments: list(...args...) but when the condition is printed with io/format-err("%s\n", condition) the print-object methods for args aren't called. For example one of the args is a <token> that has a print-object that displays the line number of the token, but it just displays as {<token>}.) Adding this method fixes that:
define method io/print-message (cond :: <lox-error>, stream :: <stream>) => ()
apply(io/format, stream,
cond.condition-format-string,
cond.condition-format-arguments);
io/force-output(stream);
end method;
This goes directly against what the doc says: "You should not specialize the print-message protocol for subclasses of
So anyway, maybe we just need a similar method defined on <format-string-condition>, and to delete that comment.
The documentation for <format-string-condition> and <simple-condition> is incorrect about one being a superclass of the other. They are the same object. define constant <format-string-condition> = <simple-condition>;