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

Re: Declaration before variable



	
    Date: 23 Jul 1986 1252-PDT
    From: Rem@IMSSS
    To:   NGALL%G.BBN.COM@SCORE
    Subject: Declaration before variable
    
    ...
    Perhaps LISP should do this:
    
    (DEFUN (STRING FOO) ((INTEGER X1 X2) (STRING S) (REAL Z))
      ...)
    
    I.e. anywhere a simple name can appear to introduce a new binding
    of a variable or name of function, a list of two elements can appear
    to both introduce the name and tell its type, including SPECIAL etc.
    Anywhere a sequence of names can appear, a list of more than two
    elements can appear, where the first element is the type and the
    remaining elements are names, thus ... (INTEGER X1 X2) ... has the
    same effect as ... (INTEGER X1) (INTEGER X2) ...
    
    This would make it absolutely clear which value is being declared,
    instead of this crock:
     (DE FOO (X1 X2 X Z)
       (DECLARE (INTEGER X1 X2) (STRING X [SIC]) (REAL Z))
       ...)
    where we have to know that the declare affects the X1 etc. which have
    already appeared earlier as well as usages of X1 etc. that appear
    later, and may or may not affect deeper bindings X1 etc. but you
    have to read the manual to find out which ones it affects.
    
    Should my idea be submitted to CL discussion?? (does it have any merit?)

I would love such a declaration scheme.  I did not propose such a
radical change since I felt that, while some implementors had
expressed interest in 'cleaning up' the semantics of declarations, no
one wanted a really radical change.

In my proposal, I kept as close to the syntax and semantics of current
declarations as I could.  The only real 'change', is that first
proposed by Pavel: a declaration should not have a scope greater than
the object to which it refers.

If everyone is willing to consider a radical change to decls, I second
REMs proposal.

-- Nick