home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 4908 < prev    next >
Encoding:
Internet Message Format  |  1992-12-12  |  2.9 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!emory!wupost!spool.mu.edu!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torek
  2. From: torek@horse.ee.lbl.gov (Chris Torek)
  3. Newsgroups: comp.software-eng
  4. Subject: what is `code? (was C code layout)
  5. Date: 12 Dec 1992 23:17:01 GMT
  6. Organization: Lawrence Berkeley Laboratory, Berkeley CA
  7. Lines: 54
  8. Message-ID: <27952@dog.ee.lbl.gov>
  9. References: <1992Dec11.020200.944@seq.uncwil.edu> <1992Dec11.152310.12726@fcom.cc.utah.edu>
  10. NNTP-Posting-Host: 128.3.112.15
  11.  
  12. (first a short note on style)
  13.  
  14. In article <1992Dec11.152310.12726@fcom.cc.utah.edu> bryant@ced.utah.edu
  15. writes:
  16. >... Standards are fine and students should learn that they will probably
  17. >be required to code to standards when they get a real job. Why rob them
  18. >of the LEARNING experience of trying different styles when they are
  19. >students?
  20.  
  21. If any one teacher decrees a certain style, several others will decree
  22. others or not decree one at all, so this particular complaint seems
  23. unjustified (at least for students for whom programming is a large part
  24. of their coursework---in a `Pascal for Psych Majors' class a single
  25. particular style requirement may have a more lasting effect, and hence
  26. requires more care).
  27.  
  28. >WHAT! A makefile is NOT CODE.
  29.  
  30. A makefile certainly *is* code.  The Unix `make' utility is programmed
  31. in a peculiar mix of declarative and imperative operations.  The
  32. declarative sections describe interdependencies (`foo.o may change
  33. whenever foo.c or global.h changes'), and the imperatives are fed to
  34. the shell for processing (`to produce foo.o, execute the following
  35. commands').
  36.  
  37. (Most `make' clones, including GNUmake and Pmake, have added typical
  38. imperative-language directives, so that one can, for instance, say `for
  39. i in x y z:  declare that $i depends on g and when rebuilding $i use
  40. ...' or `if the file ../Makefile.inc exists, read it'.  In a sense this
  41. is a loss: an entirely-declarative language has the advantage of
  42. allowing arbitrary implementation changes.  On the other hand, through
  43. clever use of macros and inclusion, one can now reduce many makefiles
  44. entirely to declarations; the Berkeley net.2 distribution has many
  45. programs whose makefile simply names the program and, if necessary, the
  46. source files.  [The default is to assume that program foo is built from
  47. foo.c.  All C-language inclusion dependencies are derived
  48. semi-automatically.])
  49.  
  50. One mini-language I created recently consists entirely of declarations,
  51. such as:
  52.  
  53.     The name `esp' represents a device which
  54.       attaches to an sbus interface,
  55.       and provides a scsi interface.
  56.     The code for an `esp' is built from
  57.       the C source file sparc/sbus/esp.c,
  58.  
  59. After reading several sets of these files, the `compiler' for this
  60. language emits, among other things, a makefile.  This makefile is still
  61. code, but it is no longer *source* code.  The source is the set of
  62. declarations.
  63. -- 
  64. In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
  65. Berkeley, CA        Domain:    torek@ee.lbl.gov
  66.