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

  1.   The setf macro will now handle all car and cdr forms (i.e. c{ad}+r).
  2.   Thanks to peter norvig for this.
  3.  
  4.   There is a new macro called 'defvar'.  It is used to declare special
  5. variables and optionally to give them an initial value.  It is used
  6. at top level in a file (outside of defuns).
  7.  
  8. forms:
  9. (defvar foo)    ; declares foo to be special
  10. (defvar bar 3)    ; declares bar to be special and when this file is read in
  11.         ; bar will be given the value 3 if it is unbound.
  12. An advantage of '(defvar foo)' over '(declare (special foo))' is that if
  13. a file containing defvars is loaded (or fasl'ed) in during compilation,
  14. the variables mentioned in the defvar's will be declared special.  The only
  15. way to have that effect with '(declare (special foo))' is to 'include'
  16. the file.  
  17.  
  18.  There is a new macro, 'environment', which can be used at the beginning of
  19. a file to specify what sort of environment this file needs in order to be
  20. compiled or run.  For example:
  21. (environment (compile eval) (files mymacros othermacros)
  22.          (compile) (syntax maclisp))
  23.  
  24. says that when compiling or loading into the interpreter, the files
  25. mymacros and othermacros should be loaded (if they aren't loaded already).
  26. When compiling, the maclisp syntax should be used.
  27. The general form of 'environment' is:
  28.    (environment when1 what1
  29.                when2 what2
  30.         ...    ...
  31.         whenN whatN)
  32. the when's are a subset of (eval compile load), and the symbols have the
  33. same meaning as they do in 'eval-when'.
  34. The what's are either
  35.     (files file1 file2 ... fileN)
  36.         insure that the named files are loaded.  To see if fileX
  37.         is loaded, it looks for a 'version' property under
  38.         fileX's property list.  Thus to prevent multiple loading,
  39.         you should put
  40.         (putprop 'myfile t 'version) at the end of myfile.l
  41.     (syntax type)
  42.         type is either maclisp, intlisp, ucilisp, franzlisp
  43.         This sets the syntax correctly.
  44.  
  45. There are additional macros to set of standard environments:
  46. (environment-maclisp)  sets up the maclisp environment.  This is what
  47.     you would get by using the -m switch to liszt.
  48.  
  49. (environment-lmlisp)  sets up the lisp machine environment. This is like
  50.     maclisp but it has additional macros.
  51.  
  52.     
  53. It is possible to add when's and what's to the specialized environments,
  54. e.g.
  55.  (environment-maclisp (compile eval) (files foo bar))
  56.  
  57.  
  58.  
  59.   
  60.  
  61.  
  62.  
  63.