OPEN silently changes element type of stream
[LWW 5.0, but I also see this with 4.4.6]
CL-USER 3 > (open "/tmp/test.txt"
:if-exists :append
:if-does-not-exist :create
:element-type 'lw:simple-char)
#<STREAM::LATIN-1-FILE-STREAM C:\tmp\test.txt>
CL-USER 4 > (stream-element-type *)
BASE-CHAR
Is that intended behaviour? I find that very disturbing (unless I'm
missing something). I explicitely specify an element type, but LW
ignores it.
My guess is that this is because I didn't specify an external format,
but I don't find a justification for this behaviour in the docs. The
LW Reference Manual for OPEN says that an error is signaled if the
element type doesn't satisfy the requirements for the external format,
but this is not the case here. The CLHS entry for OPEN says that "a
substitution of types such as that which goes on in upgrading is
permissible." But from my understanding this is also not the case, as
upgrading means that the type is substituted with a subtype, not a
supertype.
(Yes, I understand that the stream above gets a Latin1 external format
by default and so BASE-CHAR should suffice, but nevertheless...)
Thanks,
Edi.