Christophe Rhodes <csr21@...> writes:
>> (PATHNAME was UNSAFELY-FLUSHABLE, so the call was elided.)
>
> I don't understand this. Firstly, I don't understand why the call can
> ever be elided, since the result is being used;
My impression is that it was being elided because the result value of
PATHNAME is always known to be true -- so first the second leg of IF is
deleted, at which point the return value isn't used anymore.
...but I didn't look at what it _really_ happening at IR. Obviously
something more complicated then that.
> secondly, what is the difference between PATHNAME and all the other
> UNSAFELY-FLUSHABLE functions we have?
PACKAGE-NAME has a known return type of (OR SIMPLE-STRING NULL), so
the IF remains intact? MERGE-PATHNAMES seems to exhibit the same
behaviour, and has an analogous DEFKNOWN.
> Consider
> (defun foo (x)
> (format t "~S~%" (ignore-errors (pathname x)))
> (if (ignore-errors (pathname x)) :pathname :no-pathname))
> and
> (defun bar (x)
> (format t "~S~%" (ignore-errors (package-name x)))
> (if (ignore-errors (package-name x)) :package :no-package))
>
> I can trigger Richard's bug with
> (foo sb-sys::*tty*)
> but not with
> (bar "DOES-NOT-EXIST")
> and I don't know why.
It gets even "better": (foo nil) works, unlike (foo sb-sys::*tty*) !!
(Pre 0.9.15.13, that is, 0.9.15.13 exhibits the same with MERGE-PATHNAMES.)
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious."
Lispnik: "Buddha is big, has hairy armpits, and laughs."
|