Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!helios.ee.lbl.gov!pasteur!paris.Berkeley.EDU!mcgrath From: mcgrath@paris.Berkeley.EDU (Roland McGrath) Newsgroups: comp.std.c++ Subject: Re: foo() => foo Message-ID: Date: 3 Aug 90 19:03:18 GMT References: <26717@pasteur.Berkeley.EDU> <925@bbxsda.UUCP> Sender: news@pasteur.Berkeley.EDU Organization: Hackers Anonymous International, Ltd., Inc. (Applications welcome) Lines: 33 X-Local-Date: 3 Aug 90 12:03:18 PDT In-reply-to: scott@bbxsda.UUCP's message of 3 Aug 90 15:33:45 GMT If the reason people want the expression "foo" to mean "foo()" (which I think is a bad idea, since "foo" already means "&foo"), is to make it possible to hide whether something is a member or a method, why not instead implicitly define functions for members? For example, class foo { public: int member; }; would be equivalent to: class foo { public: int member; int member(void) { return member; } }; I don't particularly favor this proposal, but it's better than incompatibly redefining what a function name by itself means. My solution to this problem would simply be to have all members private, with public methods to access them. This is commonly done in Smalltalk (where it is the only way to do it, since all instance variables are private). It is a bit more code to write (another line per member), but not a lot. -- Roland McGrath Free Software Foundation, Inc. roland@ai.mit.edu, uunet!ai.mit.edu!roland