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