[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More FORMAT
I believe that all format directives not covered by the standard should
be "is an error." This includes providing incorrect arguments to the
format directives as well as using undefined format directives.
Implementations are then free to ignore the colon in "~:%", signal an
error, or even provide an extension that gives this a meaning. In the
latter case, it would be nice if there were a mode that does flag
nonstandard usages.
~@R and ~:@R are abominations, but if we have to have them, I agree that
the standard should specify what ranges of numbers are covered by these
directives. Cleanup committe: has anyone looked into this?
I can not find any reference that indicates a string may be
used as a stream. The nearest thing is on page 331,
WITH-OUTPUT-TO-STRING. This appears to exactly describe the
behavior described above (as if the following transformation had
occured) (with-output-to-string (foo x) (format foo "test"))
However, I don't find anything in FORMAT which says this is
expected or allowed. Of course, (STREAMP X) => NIL.
CLtL p. 386: "If destination is a string with a fill pointer, then in
effect the output characters are added to the end of the string (as if
by use of VECTOR-PUSH-EXTEND)." So the implementation in question was
correct in appending the formatted output to the string.
One of these implementations even violates this further, by
extending X if it goes beyond 10 characters. I can find absolutely
nothing to allow this, as it is not :adjustable. In fact, every
possible justifying reference to allowing the above FORMAT would
still cause an error (or would just ignore) in the case of over
extension.
Indeed, CLtL p. 296 explicitly states that if the fill pointer gets too
large and the vector is not adjustable, an error should be signalled.