home *** CD-ROM | disk | FTP | other *** search
- From: sfk@otter.hpl.hp.com (Steve Knight)
- Date: Tue, 22 Dec 1992 14:13:51 GMT
- Subject: Re: POP syntax
- Message-ID: <116670037@otter.hpl.hp.com>
- Organization: Hewlett-Packard Laboratories, Bristol, UK.
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscit.sc.hp.com!hplextra!otter.hpl.hp.com!otter!sfk
- Newsgroups: comp.lang.pop
- References: <57553@dime.cs.umass.edu>
- Lines: 42
-
- Continuing Ian Rogers transliteration from C-syntax to POP-syntax ...
-
- Robin Popplestone's original, with correction and standard whitespace and
- indentation :-
-
- maplist( x, f ) {
- null( x ) ? [] : f( hd( x ) ) :: maplist( tl( x ), f )
- }
-
- And here's Ian Rogers POP version, modified to use -null- (because that's
- an error in Robin's code) _but_ using the dot notation for elegance.
-
- define maplist( x, f );
- x.null and [] or x.hd.f :: maplist( x.tl, f )
- enddefine;
-
- Not surprisingly, when we lay out the code correctly, we find that the
- POP code is more concise and visually simpler. This situation is
- reversed when we add in the obligatory "lvars" declarations, alas.
- Here's the kicker ...
-
- define maplist( x, f );
- lvars x, f; ;;; pointless.
- x.null and [] or x.hd.f :: maplist( x.tl, f )
- enddefine;
-
- These extra declarations are pointless clutter forced upon the reader
- by historical changes within POP-11. Unfortunately, the reader _must_
- read these declarations and understand their meaning, since any
- change leads to a massive change in semantics. (In fact, the first two
- versions of maplist given here are completely wrong because of the
- omitted declarations. The arguments default to "vars" and therefore
- wrongly mask other top-level declarations of -x- and -f- during the
- invocations of the procedure -f-.)
-
- To my mind, Ian has produced a nice little demonstration -- by comparison
- with another programming language -- why obligatory declarations are
- harmful to POPs syntax. The obvious solution that has been suggested to
- me very frequently (as Pop9x coordinator) is to make the default
- declaration "lvars". And I see this as very sensible.
-
- Steve
-