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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,76878622fd40c57 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-19 13:11:46 PST Path: nntp.gmd.de!newsserver.jvnc.net!darwin.sura.net!gwu.edu!gwu.edu!not-for-mail From: mfeldman@seas.gwu.edu (Michael Feldman) Newsgroups: comp.lang.ada Subject: Re: GNAT-Problem Set_Line(), Set_Col() Date: 15 Nov 1994 17:41:12 -0500 Organization: George Washington University Message-ID: <3abde8$t6u@felix.seas.gwu.edu> References: <395jba$kbs@tucs6.rz.tu-cottbus.de> <3aad5q$qn9@watnews1.watson.ibm.com> <3aari4$jlc@felix.seas.gwu.edu> NNTP-Posting-Host: 128.164.9.3 Date: 1994-11-15T17:41:12-05:00 List-Id: In article , Tucker Taft wrote: >>I know the usual arguments about portability and predefined types, >>but of course Text_IO.Count is also a predefined type with implementation >>defined range, so the advantage is not at all obvious. > >The justification, if any, for a separate type is not because >of the implementation-dependence of the range, but rather because >there is some value in having a strong type distiction here. I don't really see it. >I personally think this was (mild) overkill in the strong typing >department. On the other hand, there are those who are still annoyed >that the predefined type String is indexed by Positive rather than its >own unique type, so I doubt if you can please everyone in this >area. "Use type" makes it a little more palatable to have multiple >integer types running about in Ada 9X. Well, I think it would be more palatable to be consistent. The same justification for indexing String by Positive would justify using Positive as the file count, as you point out below. >As usual, there is the tension between naive and simple use, >and the advantages provided by strong type checking. Of course, but that is not enough in itself to justify the type. The month, day, and year types in Calendar are mere Integer subtypes; the index type in String is a mere Integer subtype; yet the record count, column count, and line count - three different ranges with different uses - are all the same new type. >Since Set_Col and Set_Line are a bit more sophisticated than >other Text_IO features, beginning to use them is perhaps a >good indication that it is time to start learning about the >advantages (and occasional mild annoyances ;-) of strong type >distinctions between numeric types. It is an important >strength of Ada, IMHO, that integers used for indexing into >arrays are distinguishable by type. If one thinks of the >characters on a page as being in an array, then it is appropriate >that Set_Col and Set_Line have their own "index" type (of course, >this line of reasoning argues that Set_Col and Set_Line really ought >each to have its own separate "index" type). Indeed, and the same goes for String. And, truth to tell, for Calendar.Month_Number, Day_Number, Year_Number. This is a mild inconsistency, not a source of major grief in the language, but it is aggravating enough that I'd hoped for a better language-lawyerly justification than you gave, Tuck... Generally the design of Ada is very careful and I hesitate to come down too hard on what look like inconsistencies, because they usually are well-thought-out. IMHO, this one is not. Oh well. Cheers - Mike Feldman ------------------------------------------------------------------------ Michael B. Feldman - chair, SIGAda Education Working Group Professor, Dept. of Electrical Engineering and Computer Science The George Washington University - Washington, DC 20052 USA 202-994-5919 (voice) - 202-994-0227 (fax) - mfeldman@seas.gwu.edu (Internet) ------------------------------------------------------------------------ Ada on the World-Wide Web: http://lglwww.epfl.ch/Ada/ ------------------------------------------------------------------------ "Non illegitimi carborundum." (Don't let the bastards grind you down.) ------------------------------------------------------------------------