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-15 16:56:39 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!xlink.net!news.dfn.de!swiss.ans.net!howland.reston.ans.net!usc!crash!telesoft!kst From: kst@alsys.com (Keith Thompson) Subject: Re: GNAT-Problem Set_Line(), Set_Col() Message-ID: Originator: kst@pulsar Sender: news@alsys.com (USENET News Admin @flash) Organization: Alsys, San Diego, CA, USA References: <395jba$kbs@tucs6.rz.tu-cottbus.de> <3aad5q$qn9@watnews1.watson.ibm.com> <3aari4$jlc@felix.seas.gwu.edu> Date: Wed, 16 Nov 1994 00:56:39 GMT Date: 1994-11-16T00:56:39+00:00 List-Id: In <3aari4$jlc@felix.seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes: > I'd like to hear from Norm or another Ada Wise Person why it was thought > necessary to declare a new type for Text_IO.Count, instead of simply using > Positive. 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. > > In my opinion, the use of a new type here causes exactly the kind of > confusion Andreas encountered; are the benefits of a distinct type in > this case worth it when balanced against the confusion? Well, I'd like to think of myself as an "Ada Wise Person". 8-)} Why should the maximum number of lines in a text file be the same as the largest value of type Integer? Text_IO.Count is a predefined type, but it's predefined by the implementer of Text_IO, who can choose a reasonable range for it. On some targets, you might want type Integer to be only 16 bits (this was probably more true in 1983 than it is now, but it's still allowable). Having Text_IO blow up on text files longer than 32767 lines would have been A Bad Thing (though I suppose that, with careful implementation, it wouldn't necessarily blow up unless you try to set or query the current line number). Overuse of the predefined types is considered (by many) to be bad style anyway, since it weakens Ada's strong type checking. It's too bad when that checking complains about something that's actually safe, but that's the price we pay for having the compiler detect more of our mistakes. This is exactly what user-defined integer types are for. function "+"(Left: Apples; Right; Oranges) return Fruits; -- Keith Thompson (The_Other_Keith) kst@alsys.com TeleSoft^H^H^H^H^H^H^H^H Alsys, Inc. 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718 /user/kst/.signature: I/O error (core dumped)