From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e55245590c829bef X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: _Type vs no _Type Date: Fri, 05 Nov 2010 18:52:03 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <86wroy58ff.fsf@gareth.avalon.lan> <86pqup5xfy.fsf@gareth.avalon.lan> <86y69d3rec.fsf@gareth.avalon.lan> <82lj5c5ecm.fsf@stephe-leake.org> <82zktq4n9b.fsf_-_@stephe-leake.org> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1288997523 21443 192.74.137.71 (5 Nov 2010 22:52:03 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 5 Nov 2010 22:52:03 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:zxMrKZmHPEl6VbKsdqs1GsVl9Qk= Xref: g2news1.google.com comp.lang.ada:15297 Date: 2010-11-05T18:52:03-04:00 List-Id: Jeffrey Carter writes: > Not thinking about indentation is fine. It would also be fine if you > never thought about type identifiers. But using _Type doesn't eliminate > thinking about type identifiers, just thinking about /good/ type > identifiers (the most important kind of thinking). Well, you still have to think of something /good/ to go before the "_Type". > I disagree very strongly with the single-letter idea. Although I have > seen plenty of single-letter parameter names, I have never seen a case > where it was appropriate, or where a little thought couldn't come up > with good names. ^^^^ But, you see, some folks, including me, think single-letter parameters names ARE "good", in some cases. Here's an example (from the GNAT sources, file sinfo.ads): function Abort_Present (N : Node_Id) return Boolean; The body of this function is short, so the single-letter "N" doesn't get lost. What would you call it? It could just as well be "Node" or (in Not-Ada) "node_id", but that doesn't add any useful information to the reader of the program, IMHO. And named notation doesn't make sense for calls to Abort_Present, no matter what the parameter name is. What about operators? The Ada RM says: function "+"(Left, Right: T) return T; but I think that's just silly. I usually say: function "+"(X, Y: T) return T; Named notation never, ever, ever makes sense for operators. And if the body of "+" is short, single-letter names are crystal clear. Verbosity is good when it imparts useful information to the reader of the code, but not otherwise. - Bob