home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18549 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.5 KB  |  57 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!paladin.american.edu!gatech!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!cv3!dschieb
  3. From: dschieb@muse.cv.nrao.edu (Darrell Schiebel)
  4. Subject: Re: template disappointments ... (suggesti
  5. In-Reply-To: cflatter@nrao.edu's message of Wed, 30 Dec 1992 16: 11:36 GMT
  6. Message-ID: <DSCHIEB.92Dec30132921@muse.cv.nrao.edu>
  7. Sender: news@nrao.edu
  8. Organization: National Radio Astronomy Observatory
  9. References: <1hqnd6INNe83@agate.berkeley.edu> <1992Dec30.161136.24591@nrao.edu>
  10. Date: Wed, 30 Dec 1992 18:29:21 GMT
  11. Lines: 44
  12.  
  13. In article <1992Dec30.161136.24591@nrao.edu> cflatter@nrao.edu (Chris Flatters) writes:
  14. >
  15. >Newsgroups: comp.lang.c++
  16. >Path: cv3.cv.nrao.edu!laphroaig!cflatter
  17. >From: cflatter@nrao.edu (Chris Flatters)
  18. >Sender: news@nrao.edu
  19. >Reply-To: cflatter@nrao.edu
  20. >Organization: NRAO
  21. >References: <1hqnd6INNe83@agate.berkeley.edu>
  22. >Date: Wed, 30 Dec 1992 16:11:36 GMT
  23. >Lines: 26
  24. >
  25. >In article 1hqnd6INNe83@agate.berkeley.edu, jbuck@foucault.berkeley.edu (Joe Buck) writes:
  26. >>In article <24508@alice.att.com> ark@alice.UUCP () writes:
  27. >>>In article <DSCHIEB.92Dec29133556@muse.cv.nrao.edu> dschieb@muse.cv.nrao.edu (Darrell Schiebel) writes:
  28. >>>>         list<vector<int>> list_vec_int;
  29. >>>
  30. >>>Huh?? This works fine -- just remember to put a space between the
  31. >>>two > characters so the >> won't be taken for a shift-right symbol.
  32. >>
  33. >>This is such a common error (and is so ugly) that compiler writers
  34. >>would be well advised to add productions to their grammar that catch
  35. >>it, or magic that splits the >> token into two tokens in this case
  36. >>if that fits in with the compiler's structure.
  37. >>
  38. >>Yes, I know that the rules of lexical analysis force the >> to be one
  39. >>token, but list<vector<int>> is a perfectly natural way of writing
  40. >>this thing, so perhaps it should be permitted even at the cost of
  41. >>adding an ugly rule to the grammar.
  42. >
  43. >It requires more than a modification to the grammar (unless you find it
  44. >acceptable to allow arbitrary amounts of whitespace in the middle of
  45. >a right-shift operator).  You would have to switch lexical analysers
  46. >while parsing a template declaration or a template class name and switch
  47. >back afterwards.
  48.  
  49. This is a bit of an exaggeration. I believe that the true semantics of 
  50. nested ">"s could be determined totally based on left context. Perhaps
  51. a right-shift operator type template argument could cause a problem, but
  52. if left context were available, I think this could be resolved also.
  53. However, one does not often have the advantage of the entire left context.
  54.  
  55.  
  56.                             Darrell Schiebel
  57.