this came up when trying to use slime's inspector to inspect a socket connected to a remote server. the following snippet signals an error:
CL-USER> (let* ((socket (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp))) (sb-bsd-sockets:socket-connect socket #(127 0 0 1) 8080) (sb-bsd-sockets:socket-make-stream socket)) #<SB-SYS:FD-STREAM for "a constant string" {40D28759}> CL-USER> (pathname *) Error: The value NIL is not of type PATHNAME. [Condition of type TYPE-ERROR]
however, substitiuting the call to pathname for its definiton return NIL:
CL-USER> (let* ((socket (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp))) (sb-bsd-sockets:socket-connect socket #(127 0 0 1) 8080) (sb-impl::with-pathname (pathname (sb-bsd-sockets:socket-make-stream socket)) pathname)) NIL CL-USER>
i'm not really sure what the correct answer is, according to the hyperspec pathname must return a pathname object and NIL is definetly not a pathname object. at the same time a file stream is a pathname designator and pathname is defined to accept pathname designator (the hyperspec doesn't mention any exceptional situations). is there some (non neccessarily portable) means to determine if a stream is a valid value for passing to pathname?
please ignore. i meant to send that to sbcl-devel.