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

Binding the same variable twice in a single form

    Date: Fri, 13 Apr 90 11:47:11 EDT
    From: William R. Swanson <traveler@Think.COM>

       Date: Thu, 12 Apr 90 17:41 EDT
       From: barmar@Think.COM (Barry Margolin)

       In the case of IGNORE variables, the portable way to do this is with the
       IGNORE declaration:

		 <use X somehow>)

       I can't think of any other reason why you would want to bind the same
       variable twice in the same form, so the larger question should be moot.


    Devils' advocate: How about the following (obviously kludgy) example?

    (let* ((operation (get-operation))
	   (operation (if (null operation)
	   (status (if operation :safe :panic)))
       ... code that uses operation and status variables ...)

    for example:

    (defun get-a-number ()
      (let* ((number (read))
	     (number (if (numberp number) number 0)))
	 (print number)))

    It may not be nice programming style, but it works...

Your example uses sequential binding, whose semantics in this case are
obvious (although I'm not sure the ANSI draft specifically mentions
this).  I was talking about parallel binding.