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

[csi!meehan%UUCP: syntax]



Date: Mon, 23 Dec 85 22:52:38 EST
From: Jim Meehan <csi!meehan%UUCP at YALE.ARPA>
To:   Jonathan A Rees <rees at YALE.ARPA>
cc:   csi!ferguson at UUCP
Re:   syntax
Message-Id: <6603@csi-ring>
In-Reply-To: Your message of Mon, 23 Dec 85 18:02:42 EST

[Jonathan: If you think this would be interesting or appropriate for
the T-DISCUSSION bboard, feel free to forward it there.]

=========================================================================
         ...
         (DEFINE-SYNTAX (KAR X) `(CAR ,X))
         (LET ((CAR CDR)) (KAR '(1 2 3))) => (2 3)
         ...
    The above is a terrible example; you could have written
    (define-integrable (kar x) (car x))
    
Right.  The example I should have used was this:

(LET ((CAR CDR)
      (L '(1 2 3)))
  (POP L))

=========================================================================
    ...
    I hope that this further illustrates to people just how intractible
    macros are.  Don't use them if you can avoid it! ...  There are
    occasional cases where macros are desirable (I generally only use
    them for top-level forms)...

I'm puzzled.  At the moment, in T 2.8, there are 13 special forms and
71 macros in the *STANDARD-SYNTAX-TABLE*.  I'd put the 71 macros into
3 categories:

I. Macros useful primarily at top level:
DEFINE-CONSTANT                   DEFINE-PREDICATE            
DEFINE-STRUCTURE-TYPE             DEFINE-SYNTAX               
DEFINE-INTEGRABLE                 DEFINE-SETTABLE-OPERATION   
DEFINE (also inside LET)          DEFINE-OPERATION
DEFINE-METHODS 

II. Macros useful (i.e., reasonably meaningful) anywhere:
DESTRUCTURE                       WITH-OUTPUT-TO-STRING    
DESTRUCTURE*                      PUSH                     
CASE                              XCOND                    
WITH-OUTPUT-WIDTH-STREAM          XSELECT                  
BLOCK0                            WITH-INPUT-FROM-STRING   
MODIFY                            DECREMENT                
MACRO-EXPANDER                    OR                       
LET*                              SELECT                   
COND                              DELAY                    
WITH-OPEN-STREAMS                 INCREMENT                
SET                               ITERATE                  
WITH-OUTPUT-TO-LIST               EXCHANGE                 
MODIFY-LOCATION                   BIND*                    
POP                               XCASE                    
LET*                              DO                       
AND                               SWAP                     
UNWIND-PROTECT

III. Macros that might be [reasonably implemented as] special forms,
but are useful anywhere, not just at top level:
OPERATION                         OBJECT 
LOCATIVE                          LOCALE 
LET                               LABELS 
CATCH                             BIND   

IV. Other macros (mostly implementation stuff):
DEFINE-INSTANCE-METHODS           %DEFINE-SYNTAX               
IGNORE                            DEFINE-MACRO                 
DECLARE-SETTER                    REFERENCE                    
^                                 DEFINE-STRUCTURE-SELECTOR    
COMMENT                           IGNORABLE                    
OPERATION-DISPATCH                UNTRACE                      
**BACKQUOTE-MARKER**              GC-DEFER                     
HANDLER                           IMPORT                       
SYNONYM                           IF-INTEGRATED                
REQUIRE                           HERALD                       
TRACE                             PP                           

While there's lots of room to argue about whether certain macros (e.g.,
the ones in Categories I and III) could or should be special forms, I
don't know how you can avoid all 32 of the macros in Category II, and
I doubt you'd recommend making them all special forms.