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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,74a0352df2d2082a X-Google-Attributes: gid103376,public From: Alan Brain Subject: Re: strongly typed langauge Date: 1996/09/20 Message-ID: <3242665A.76FD@dynamite.com.au>#1/1 X-Deja-AN: 183976201 references: <51rai1$2jh@rc1.vub.ac.be> content-type: text/plain; charset=us-ascii organization: @Home mime-version: 1.0 reply-to: aebrain@dynamite.com.au newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win16; I) Date: 1996-09-20T00:00:00+00:00 List-Id: AGBOH CHARLES wrote: > Hi > Could Some explain to me what the term "strongly typed language" is in the > context of ada. Could you give some examples and tips as on how to > avoid errors related to this particular domain. Geen Problem, Pas de Probleme OK, this is best answered by an example. Suppose you had a quantity of 5 apples and 11 oranges. In an untyped language, you could add 07 and 0B (Hex) to make 10 (Hex) In a weakly typed language, you could declare them both as Integer quantities, and add 5 to 11 to get 16 - but 16 of what? In a strongly typed language, unless you'd made a new type, FRUIT_TYPE, and defined that apples and oranges were both subtypes of this base type, the compiler would reject a statement adding apples to oranges, as they are two different types. Similarly, suppose you knew that the number of apples had to be within the range 0 to 47. A strongly typed language would allow you to express this, as subtype NUMBER_OF_APPLES_TYPE is INTEGER range 0..47; and any operation which resulted in a quantity >47 or <0 would cause a failure to be detected. Tot Ziens/A Bientot ---------------------- <> <> How doth the little Crocodile | Alan & Carmel Brain| xxxxx Improve his shining tail? | Canberra Australia | xxxxxHxHxxxxxx _MMMMMMMMM_MMMMMMMMM ---------------------- o OO*O^^^^O*OO o oo oo oo oo By pulling Maerklin Wagons, in 1/220 Scale