home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.std.c++:1188 comp.lang.c++:13692
- Newsgroups: comp.std.c++,comp.lang.c++
- Path: sparky!uunet!mcsun!news.funet.fi!cc.tut.fi!jk87377
- From: jk87377@cc.tut.fi (Juhana Kouhia)
- Subject: Re: Exponentiation operator proposal
- Message-ID: <1992Sep15.173259.28758@cc.tut.fi>
- Organization: Tampere University of Technology
- References: <HBF.92Sep14205333@durin.uio.no> <1992Sep15.054226.4126@cc.tut.fi> <1992Sep15.140027.17387@sunb10.cs.uiuc.edu>
- Date: Tue, 15 Sep 92 17:32:59 GMT
- Lines: 59
-
-
- In article <1992Sep15.140027.17387@sunb10.cs.uiuc.edu>
- pjl@sparc10.cs.uiuc.edu (Paul Lucas) writes:
- >In <1992Sep15.054226.4126@cc.tut.fi> jk87377@cc.tut.fi (Juhana
- >Kouhia) writes:
- >
- >>Instead of making exponential operator; I would like to get
- >>a new basic operation which allows programmer to define new
- >>operations like 'a ** b'; that is, the '**' is defined.
- >>('a pow b' is also good.)
- >
- >*****> The short answer is that it's a _real_ pain. The somewhat
- > longer answer is that making new operators means that you have
- > to also establish the precedence and associativity of the new
- > operator relative to all the other operators *AND* any other
- > operators created by other people. Every time an operator is
- > added, the hierarchy would have to be readjusted.
-
- I didn't thought this.
-
- > For new operators, the precedence and associativity may seem
- > arbitary at the time of creation
-
- At the compile time; just like functions are created.
- Am I missing something? In what order the compiling the X and
- the Y happens?
-
- If X and Y provides the same function with different meanings,
- how this is handled? I think the same apply to new operation.
- That is, compile time error.
- The same scope rules apply to the new operation too.
-
- Lets suppose both X and Y makes the new operation to the
- default operation precedence and associativity data set.
- If they both offers the same operation, it is compile time error.
- If both offers different operations, then this is valid.
- But how to make the common operation predence and associativity
- data set? I have to think about this a bit.
- Just by adding the both operations to the same level?
- For example,
-
- Default set:
- Level 1: * /
- Level 2: + -
-
- X:
- Level 1: * / foo
- Level 2: + -
-
- Y:
- Level 1: * /
- Level 2: + - bar
-
- The common set:
- Level 1: * / foo
- Level 2: + - bar
-
-
-
- Juhana Kouhia
-