Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!rfg From: rfg@NCD.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: overloading operator . and -> Message-ID: <4608@lupine.NCD.COM> Date: 25 Mar 91 00:48:53 GMT References: <14.UUL1.3#8618@softrue.UUCP> Organization: Network Computing Devices, Inc., Mt. View, CA Lines: 53 In article <14.UUL1.3#8618@softrue.UUCP> kearns@softrue.UUCP (Steven Kearns) writes: > >I know it is too late now, but here is my opinion on how operator . >and operator -> should have been overloadable:' > > >Notice that in the current definition, X->f is really short for >(X->) ->f . I find this strange to say the least. Sorry. It looks like you are fairly confused. Don't feel bad. You are in good company. As any good book about C will tell you, this: ptr->member is really just a convenient "shorthand notation" for this: (*ptr).member Well... at least that *used* to be true. Somewhere along the way, it was decided that this simple relationship was just too clear, too precise, and too easy to understand to allow it to just continue unchanged into C++. So something was added to help muddy the waters. Rather than treating -> as the bit of "syntactic sugar" that it was always meant to be, somebody (and I think I know who) got the idea that it ought to take on a life of its own. So it was reborn. (Or should I say "born again"? :-) And all the faithful now call it an "operator" (which it clearly isn't, any more that my aunt Emma is an "operator"). Of course, it would be one thing if we only *called* -> an "operator", but unfortunately the language (as now defined) further compounds this sillyness by allowing "->" to be overloaded! Of course nobody should bother to suggest at this stage that this may have been a mistake. As Steven says: "It's too late". There is too large of an "installed base" already which depends upon this ill-conceived "feature". That reminds me of a quote that I was reading in some trade-rag recently. Apparently some industry luminary was quoted as saying that Arlington National Cemetery was a good example of a "large installed base". :-) -- // Ron ("Shoot From The Hip") Guilmette // Internet: rfg@ncd.com uucp: ...uunet!lupine!rfg // New motto: If it ain't broke, try using a bigger hammer.