Michael Naunton <[EMAIL PROTECTED]> writes: > Hi, > > I'm trying to convert a Greenspun's 10th language into Common Lisp. In > cases such as the following, Python produces both a note (for the > unreachable code,) and a warning (for the bad arg to truncate during > constant folding.) > > (defun foo3 () > (let ((s "FOO")) > (typecase s > (double-float > (format t "a double: ~A~%" (truncate s))) > (t (format t "other: ~A~%" s))))) > > My questions: > > 1) Should the compiler really be emitting warnings/errors in code it can > prove is unreachable? I think not, but am willing to revise my opinion.
For me, yes. Helps to catch a lot of bugs. > 2) Is there a way to locally suppress the warning? I've got millions > of cases like this, and post-processing the output doesn't seem to be > the right thing. Yes. Look at (declare (ignorable ...)). > 3) Is there a construct or hook/how hard would it be to hack the type > inferencer to support something like: > > (defmacro op++ (x) > "Give me inline code for doubles if x is definitely a double, > else punt." > (if (inferable-type x 'double-float) > `(incf x) > `(adhoc-incf x))) Something similar is already done in the compiler. Look at the defknown/deftransform stuff in the CMUCL source. > 4) Section 5.3.5 of the CMUCL doc confuses me. I don't see how that > ecase statement can work. Why not? > Any illumination is appreciated, > Thanks, > Michael Naunton Nicolas.
