home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / lisp / lispnews / text0061.txt < prev    next >
Encoding:
Text File  |  1985-11-10  |  3.4 KB  |  98 lines

  1.   This is a long message so I'll put the most important thing first, in case
  2. you choose not to read the rest of the message:
  3.   *** object files generated by liszt 8.19 will not run in any lisp
  4.   *** older than 38.48.    Object files which were generated by
  5.   *** liszt's before 8.19 will continue to work in the new lisp.
  6.  
  7.  
  8. There were two major changes to lisp and liszt:
  9.  1) compiled functions will test at runtime to make sure that they
  10.     are passed the correct number of arguments.
  11.  
  12.  2) the lambda list keywords &optional, &rest and &aux are open compiled
  13.     in an efficient manner.
  14.  
  15. I'll refresh your memory on what the possible forms are for the & keywords:
  16.  
  17.   the formal parameter list of a def has this form
  18.   ( required-args
  19.     [ &optional optional-arguments ]
  20.     [ &rest rest-argument ]
  21.     [ &aux  aux-arguments ])
  22.  
  23.  as in this example which shows all possible forms:
  24.  
  25.  (def foo 
  26.    (lambda (a b &optional c (d 23 d-p) (dd (bar)) &rest e &aux (f 12) g)
  27.         (compute)))
  28.  
  29.    
  30.  the meaning and forms of the various parts of the formal parameter list are:
  31.  
  32.  required-args: a sequence of n (zero or more) symbols which will be bound
  33.      to the first n actual arguments.
  34.  
  35.  optional-args:    a sequence of m (zero or more) symbols which will be
  36.      bound to the next m actual arguments if they are present, or
  37.     to default values.
  38.     the forms of an optional argument are:
  39.     
  40.     foo    - bind foo to the argument if it present, otherwise bind it
  41.           to nil
  42.     (foo (expr)) - bind foo to the argument if it is present, otherwise
  43.         evaluate (expr) and bind foo to the result.
  44.  
  45.     (foo (expr) foo-p)  - bind foo to the argument if it is present, 
  46.         otherwise evaluate (expr) and bind foo to the result.
  47.         Also, bind foo-p to t if the argument is present, otherwise
  48.         bind foo-p to nil.  foo-p will be treated like an &aux
  49.         variable (see below) but it should NOT be declared in the
  50.         &aux list!
  51.  
  52.   rest-arg : a single symbol which will be bound to a list of the rest of the
  53.       arguments.  This list is cons'ed up each time the function is called.
  54.  
  55.   aux-args : these args are just like arguments to let or prog within the
  56.       function body so this & keyword isn't really necessary (but there
  57.     are few things in lisp that really are necessary).
  58.  
  59.     the forms of the aux arg are:
  60.  
  61.     foo - bind foo to nil
  62.     (foo (expr))  - evaluate (expr) and bind foo to the result.
  63.  
  64.  
  65.  
  66. The compiler understands the &keywords but the interpreter does not.  'def'
  67. will convert a form with &keywords to a lexpr which is almost equivalent.
  68. The differences are:
  69.     The interpreted form, being a lexpr, is allowed to use the 'arg'
  70.     function.  The compiled form, even with optional args,
  71.     is not a lexpr and thus 'arg' is illegal.
  72.  
  73.     The order that &aux variables are lambda bound is slightly different
  74.         between interpreted and compiled code.  As long as default
  75.     expressions reference no formal parameters after them in the
  76.     formal parameter list, there should be no problems.
  77.  
  78.     The interpreted version will not check for the correct number of
  79.         arguments.
  80.  
  81. Local functions cannot have &keywords.    
  82.  
  83. If you have any questions on this, send me mail.  This change should
  84. only break functions which expect a variable number of argument and
  85. which don't declare the fact using &optional programs.  There may be,
  86. of course, implementation errors.  If you notice anything unusual
  87. please let me know right away.  The old compiler will be
  88. in /usr/ucb/oliszt for a while.
  89.  
  90.  
  91.  
  92.     
  93.     
  94.     
  95.  
  96.  
  97.  
  98.