From -6578489824964590027
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,684a204d7f01151,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-08-30 21:15:05 PST
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ncar.ucar.edu
From: agriff@tin.it (Andrea Griffini)
Newsgroups: comp.std.c++
Subject: C++0X: this-> and member naming convention
Message-ID: <3d6f113c.1181304@news.tin.it>
X-Newsreader: Forte Free Agent 1.21/32.243
X-Complaints-To: newsmaster@tin.it
X-Trace: news1.tin.it 1030690394 80.116.57.237 (Fri, 30 Aug 2002 08:53:14 MET DST)
NNTP-Posting-Date: Fri, 30 Aug 2002 08:53:14 MET DST
Organization: TIN
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Date: Fri, 30 Aug 2002 23:10:54 CST
Lines: 37
Xref: archiver1.google.com comp.std.c++:13519


After reading a few messages about the pros and
cons of using "this->" syntax to access members
from inside a method and about a good naming
convention for members (m_..., ..._) I've been
thinking to a simple syntax extension I implemented
in a toy scripting OO language some time ago.
What about having all member prefixed by just a
single dot ? Looks to me that this should be very
easy to implement (it was for my parser) and should
offer better readability and less typing and
cluttering than "this->" or other prefixes.

May be the ideal would be having this syntax
mandatory... but this can be implemented over time
just adding it as a possibility in the next C++
standard (and even if mandated this would surely
become a "warning" level diagnostic by compiler
implementers for quite a while).
I think that the improved readability should be
worth the change... in current C++ when one finds
a name that is not a local name in the scope of
a method it may be a data member of the class,
of any ancestor class or a global. It can be hard
to discover where a name may come from.

Has this been considered already ? To me the
single dot prefix looks also really natural.

Andrea

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



