home *** CD-ROM | disk | FTP | other *** search
- From: dds@speedy.CND.HP.COM (Darren Smith)
- Date: Fri, 24 Jul 1992 23:41:19 GMT
- Subject: Re: Handling of operator . proposal
- Message-ID: <1070008@speedy.CND.HP.COM>
- Organization: HP Network and System Management Division
- Path: sparky!uunet!usc!sdd.hp.com!hpscdc!hplextra!hpfcso!hpcnd!speedy!dds
- Newsgroups: comp.lang.c++
- References: <Bqs38H.4L9@taligent.com>
- Lines: 44
-
- | "." is only an operator in the sense that "::" is, i.e., syntactically;
- | it's not a run-time operation, like all the currently-overloadable
- | operators are.
-
- It is true that operator. is *currently* only a syntactic operation,
- and not a run-time operation. Why can't it be both?
-
- Here's an analogy for you: function calls. In both C and C++, you can
- make function calls that are resolved at compile time (OK. technically
- at load time. Never-the-less, not at runtime). This is sufficient for
- most uses, and is all that some languages offer. However, we also
- have these things called "function pointers", that allow you to
- determine which function to call at runtime. Yes, the syntax is slightly
- different from regular function calls, so this is not a perfect analogy.
- However, I think this is largely because of the history of "C". The
- concept of being able to do something at runtime that most of the time
- can be determined at compile or load time is not unprecedented in the
- language. The operator.() proposal essentially allows you to do
- something at runtime that is currently only done at compile time.
-
- [ Side note: Is that last statement really truly? If I do something
- like (*anobject).member, the offset to member will be evaluated at
- comile time, but the actual location in memory is determined at
- runtime. ]
-
- The argument that operator.() is only a syntactic operation is
- essentially a meaningless, though true, statement. The question is:
- is there a good reason that it should remain so? That is the issue
- that should be addressed when you say it's not a runtime operation.
- What problems are caused by it having the possibility of being a runtime
- operation? Are they solvable?
-
- Also, saying that operator.() is only a syntactic operation, says that
- you will never support *any* proposal that makes operator.() overloadable
- in a way that requires a runtime decision (I can envision a scheme that
- could work at compile time only). If that is truly your position, then
- make that a separate argument from a critique of a given proposal. That
- way people can understand better your position, which is not that a
- given proposal is bad, but that all proposals for overloading operator.()
- are bad.
-
- --
- Darren Smith dds@cnd.hp.com 229-2536 Hewlett Packard
- --
-