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