home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!decwrl!world!tob
- From: tob@world.std.com (Tom O Breton)
- Subject: Re: Name of Operator
- Message-ID: <BsvxJ6.1t3@world.std.com>
- Organization: The World Public Access UNIX, Brookline, MA
- References: <168ktiINNqrl@shape.mps.ohio-state.edu>
- Date: Wed, 12 Aug 1992 19:16:17 GMT
- Lines: 29
-
- C. Xiong:
-
- > I want to introduce some new notations for these operators.
-
- Therein lies a basic impossibility. The parser simply needs to know ahead of
- time what all the operators are and how they parse. Can't add new ones
- without rewriting the compiler.
-
- This is also why you can't (For instance) make 'operator =' take two
- arguments, though classes like Complex and Pos_On_Screen could really use it.
-
-
- >But I failed, not in the definition of the operator, but in later sentence.
- >For example, I define operator as
- >
- >class vector {
- >.....
- >vector operatornl() const { [etc]
-
- Afraid not. That last line does not define an operator called 'nl', it
- defines a function called 'operatornl'. If you added a space it would simply
- not compile.
-
- Tom
-
-
- --
- Having decimated the hapless peasants, the Tom spreads its huge, scaly wings
- and soars into the wild sky... up... up... out of sight...
-