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-18 01:15:29 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!xlink.net!sol.ctr.columbia.edu!news.kei.com!news.mathworks.com!noc.near.net!inmet!spock!stt From: stt@spock.camb.inmet.com (Tucker Taft) Subject: Re: GNAT-Problem Set_Line(), Set_Col() Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <395jba$kbs@tucs6.rz.tu-cottbus.de> <3aad5q$qn9@watnews1.watson.ibm.com> <3aari4$jlc@felix.seas.gwu.edu> Date: Tue, 15 Nov 1994 19:10:21 GMT Date: 1994-11-15T19:10:21+00:00 List-Id: In article <3aari4$jlc@felix.seas.gwu.edu>, Michael Feldman wrote: >In article <3aad5q$qn9@watnews1.watson.ibm.com>, >Norman H. Cohen wrote: >>In article <395jba$kbs@tucs6.rz.tu-cottbus.de>, >> ak@informatik.tu-cottbus.de (Andreas Krohn) writes: >> >>|> When I use these functions with a variable then the compiler says >>|> "Invalid parameter list in call". >>|> If it is a number then it works. Where is the problem ? >> >>My guess is that you've declared the variables to be of type Integer. >>Set_Line and Set_Col take parameters of the integer type Text_IO.Count. >>(An integer literal is acceptable where a value of any integer type is >>expected.) > >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. 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. >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? 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. As usual, there is the tension between naive and simple use, and the advantages provided by strong type checking. 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). >Mike Feldman -Tucker Taft stt@inmet.com