Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!odi!dlw From: dlw@odi.com (Dan Weinreb) Newsgroups: comp.lang.c++ Subject: Re: Arguments to Overloaded Operators Message-ID: <381@odi.ODI.COM> Date: 10 Jun 89 22:43:54 GMT References: <11032@orstcs.CS.ORST.EDU> <1100@cadillac.CAD.MCC.COM> <238@pink.ACA.MCC.COM> <9454@alice.UUCP> Reply-To: dlw@odi.com Organization: Object Design Inc., Burlington, MA Lines: 22 In-reply-to: ark@alice.UUCP's message of 9 Jun 89 13:49:24 GMT In article <9454@alice.UUCP> ark@alice.UUCP (Andrew Koenig) writes: If it were possible for the evaluation of a node to depend on the type of its ancestors, in general that would mean that you'd have to understand an entire expression to be able to evaluate any of it. That would make evaluation much harder to understand, both for the compiler and for human programmers. I would not be surprised to find expression evaluation to be NP-hard under those circumstances. Indeed. For confirmation, read any Ada compiler. Ada does allow overloading on the returned value. This results in compilers of unspeakable complexity. There are other things that make Ada compiler complex, but it's easy to see the direct effects of overloaded returned values on the complexity of the compiler. The need to support overloading of returned values changes the entire modularity and control structure of certain parts of the compiler into a real nightmare. And it can make Ada programs hard to understand, when there's a lot of overloading. In the long run, the decision to have overloading only on arguments is a good one. Dan Weinreb Object Design, Inc. dlw@odi.com