Peter Tanski wrote: > On Sep 10, 2006, at 1:31 AM, skaller wrote: > > >> On Sun, 2006-09-10 at 00:50 -0400, Peter Tanski wrote: >> >>> On Sep 8, 2006, at 9:49 PM, skaller wrote: >>> >>> Regarding C++ template type notation, why did you choose square >>> brackets for the list of predicates, instead of angle brackets? >>> >> Because < and > are comparison operators? >> > > '<' and '>' are comparison operators in C++ as well and in C++ they > are used to mark template parameters. It all depends on context. And this is the single biggest impediment to writing a simple but robust parser for some aspects of C++, as understanding enough of the context to know whether < is an operator or a delimiter requires the ability to tell if a name is a template, which requires the ability to instantiate templates, including performing overload resolution. Without this level of language knowledge, it's not even possible to robustly pick out where top-level declarations begin and end in C++ code (so far as I can determine). > Of > course Felix's LALR parser may have an easier time with > distinguishing the trailing ">>" as an embedded predicate list from > ">>" as the right-shift operator (Felix doesn't have a right-shift > operator but you may want to use ">>" as a sequence operator). The > consequence of the C++ "maximum munch" parser, where trailing > embedded template parameters need a space "vector<int, Allocator<T> > >" should have been done away with a long time ago. > > It has been done away with now, in the working paper; the next C++ standard will allow std::vector<int, Allocator<T>> though at the cost of a little more complexity in the compiler and standard and the possibility of breaking some obscure existing code.
(Which is largely agreeing with you; < and > weren't good choices for C++, but they may have been the best available given the constraints.) -- James ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Felix-language mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/felix-language
