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

sfa error checking



    Date: 27 January 1981 05:26-EST
    From: Kent M. Pitman <KMP at MIT-MC>
    Subject:  sfa error checking
    To: GZ at MIT-MC
    cc: BUG-LISP at MIT-MC
    
	Date: 20 December 1980 08:48-EST
	From: Gail Zacharias <GZ>
	Re:   sfa error checking
    
	Consider the following session:
	    (defun nothin N '())
	    NOTHIN 
	    (setq test (sfa-create #'nothin 17. 'testing))
					    =>	#SFA-|TESTING|-70766 
	    (open test)			=>	NIL 
	    (close test)			=>	NIL 
	    (deletef test)			=>	NIL 
	    (filepos test 13.)		=>	NIL 
	    (sfa-call test #'untyi ())	=>	NIL 
	    (tyo 3 test)			=>	T 
	    (out test 2)			=>	NIL 
	    (force-output test)		=>	NIL 
	    (prin1 1 test)			=>	T 
	    (princ 'a test)			=>	T 
	    (print 'foo test)		=>	T 
	    (cursorpos test)		=>	NIL 
	    (in test)			=>	;NIL NON-FIXNUM VALUE
					       ;; Well, at least this one errs out
	  
	Do I have to define all these operations just to have them err out?
	TYI is the only one that actually complains that it is not supported.
    -----
    Yes. For the time being at least, a common way of handling this problem 
    is:
    
      (DEFUN NOTHING (SELF OP DATA)
	     (CASEQ OP
		    ((WHICH-OPERATIONS) '(TYO CLOSE))
		    ((TYO)		    ...code...)
		    (T
		     (ERROR "Unsupported SFA Operation"
			    (LIST 'SFA-CALL SELF OP DATA)))))

Even better, you should look at the file .INFO.;LISP SFA, which contains
(has for a few weeks, but didn't if you read it before then) documentation
for DEFSFA, which takes care of issues like erroring out and handling
WHICH-OPERATIONS.