home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12274 < prev    next >
Encoding:
Text File  |  1992-08-12  |  1.2 KB  |  40 lines

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