[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

local declarations



    Date: Mon, 06 May 85 12:53:00 EDT
    From: vanroggen@DEC-HUDSON@think

    What I was complaining about was the implication in the manual that
    the following code was "not meaningful":
    (TYPECASE X
      (SIMPLE-STRING
	(LOCALLY (DECLARE (SIMPLE-STRING X))
	  ...))
      ...)
    This local declaration isn't "off in left field somehwere"; it's
    quite lexical. (I'm assuming X isn't SPECIAL; that problem has
    been aired a number of times now.)
			    ---Walter


"Any REALLY good compiler" could figure this case out without needing
the explicit declaration.  (But of course it can't figure out general
cases.)

You can get around this somewhat either by using LET or by using THE:

	(TYPECASE X
	  (SIMPLE-STRING
	    ... (CHAR (THE SIMPLE-STRING X) 43) ...)
	  ...)

For true hair, use MACROLET:

	(TYPECASE X
	  (SIMPLE-STRING
	     (MACROLET ((X () '(THE SIMPLE-STRING X)))
      	        ... (CHAR (X) 43) ...))
	  ...)

[Yuk.]

--Guy