home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / misc / 3816 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  2.1 KB

  1. From: kers@hplb.hpl.hp.com (Chris Dollin)
  2. Date: Fri, 20 Nov 1992 10:12:36 GMT
  3. Subject: Re: postfix indirection operator in C
  4. Message-ID: <KERS.92Nov20101236@cdollin.hpl.hp.com>
  5. Organization: Hewlett-Packard Laboratories, Bristol, UK.
  6. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscit.sc.hp.com!scd.hp.com!hpscdm!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
  7. Newsgroups: comp.lang.misc
  8. References: <id.6S0V.FKH@ferranti.com> <Bxv2t2.4FH@mentor.cc.purdue.edu> <id.GT2V.7OE@ferranti.com> <Bxyut0.Jo@mentor.cc.purdue.edu>
  9. Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
  10. Lines: 33
  11. In-Reply-To: hrubin@pop.stat.purdue.edu's message of Thu, 19 Nov 1992 13:58:11 GMT
  12. Nntp-Posting-Host: cdollin.hpl.hp.com
  13.  
  14. In article ... hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  15.  
  16.    Certainly not from the standpoint of English speakers.  As I understand it,
  17.    *x in C denotes the object referred to by x, the object "found" AT x.  Thus,
  18.    @x would have been at least a somewhat logical notation, at least relatively
  19.    easily understood by users, as well as easy for parsing, etc.
  20.  
  21. The problem with having prefix indirection and postfix other things, namely,
  22. field selection and subscripting, is that expressions such as
  23.  
  24.     *x.y,    *x[z]
  25.  
  26. become ambiguous; is the former ``*(x.y)'' or ``(*x).y''? If all the selectors
  27. are postfix, the problem goes away; there's only one way to interpret
  28.  
  29.     x^.y,    x^[z]
  30.  
  31. (with ``^'' as postfix indirection, a la Pascal). It seems silly to introduce a
  32. notation that *forces* bracketing in half the possibilities (not necessarily
  33. half the cases, of course), when just changing its fixity makes the problem go
  34. away.
  35.  
  36. The C solution, of course, was to introduce *another* postfix, ``->'', for one
  37. case. 
  38.  
  39. [Some might say that the ambiguities of the examples could be resolved by type
  40. analysis. To this I say (a) prove that there will be no ambiguities left, (b)
  41. one should be able to parse in the absence of type information.]
  42. --
  43.  
  44. Regards,    | Applicants must also have extensive knowledge of Unix,    | MIT
  45. Kers.       | although they should have sufficiently good programming   | job
  46.             | taste to not consider this an achievement.                | ad.
  47.