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: g2news2.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: _Type vs no _Type References: <86wroy58ff.fsf@gareth.avalon.lan> <86pqup5xfy.fsf@gareth.avalon.lan> <86y69d3rec.fsf@gareth.avalon.lan> <82lj5c5ecm.fsf@stephe-leake.org> Date: Wed, 03 Nov 2010 08:14:56 -0400 Message-ID: <82zktq4n9b.fsf_-_@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt) Cancel-Lock: sha1:q+yixXM0RNMY+eTFM1ZHUbaKe1g= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: a029d4cd14fd3e029e66108237 Xref: g2news2.google.com comp.lang.ada:16131 Date: 2010-11-03T08:14:56-04:00 List-Id: Simon Wright writes: > I _think_ that Jeffrey's point is that, given weapons such as > broadsword, catapult, torpedo you might write C like > > typedef enum {BROADSWORD, CATAPULT, TORPEDO} Weapon; > void attackUsing(Weapon weapon); > > and rather than write this in Ada > > type Weapon_Type is (Broadsword, Catapult, Torpedo); > procedure Attack_Using (Weapon : Weapon_Type); > > it would be better to say\ > > type Weapon is (Broadsword, Catapult, Torpedo); > procedure Attack (Using : Weapon); > Yes, this summarizes the argument. The core of the argument is about what metric to use for "better". Those on the _Type side say the first choice is "better", because it requires trivial thought both for writing and reading, and leads to different programmers making the same choice for names. Those on the "no _type" side say the second choice is better, because better names are better, and _type is "just noise". The third choice is: package RPG is type Weapon is (Broadsword, Catapult, Torpedo); procedure Attack (Weapon : RPG.Weapon); end RPG; That was not introduced until after the two camps were firmly established. I actually think this third choice is more in the spirit of Ada than either of the other two. I've used it in a couple small projects, but my main projects are firmly committed to the _Type convention. Consistent conventions are _far_ more important than any reasons supporting _type vs no _type. -- -- Stephe