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,7b5b3c67aa2a73fe X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "(see below)" Newsgroups: comp.lang.ada Subject: Re: Easy question about Character manipulation Date: Wed, 31 Jan 2007 03:07:36 +0000 Message-ID: References: <1170100860.762334.13830@l53g2000cwa.googlegroups.com> <1d5n0ksoz75yy.3t2hhxjr35fq$.dlg@40tude.net> <1170106218.6329.63.camel@localhost> <1170121405.6329.89.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: individual.net mNyd4U8uZANVAMAfWK6e1AYmeQkrz4segKA/uhi/e/xrSeeC+E User-Agent: Microsoft-Entourage/11.3.3.061214 Thread-Topic: Easy question about Character manipulation Thread-Index: AcdE5PUtM/AM8LDYEduzcQARJIjQTg== Xref: g2news2.google.com comp.lang.ada:8755 Date: 2007-01-31T03:07:36+00:00 List-Id: On 30/1/07 22:05, in article wccwt346uhg.fsf@shell01.TheWorld.com, "Robert A Duff" wrote: > type T = 1..10; > procedure P(X: var T); > var A : 1..10; > type S = 1..10; > var B : S; > var C : 1..12345; > > is it legal to pass A, B, and/or C to P's X, in Pascal? > >> Value parameters are in effect assigned their values, >> and the permissive semantics of assignment compatibility apply; >> var parameters must be of equivalent types, and type-equivalence in >> ISO Pascal is name-equivalence. > > ...which seems to say that B and C are illegal above. Yes, and A as well. >>> ... I claim that we're just arguing over >>> terminology: saying "so-and-so are different types, but there are all >>> kinds of implicit conversions" amounts to roughly the same thing as >>> "so-and-so are the same type". >> >> It is unfortunate that the examples being used are subranges, >> because the assignment compatibility rules for subranges are >> the most lax. This complexity in the semantics of Pascal >> is necessary because it lacks the concept of a subtype, and >> is forced to smuggle in something of the facility by rather >> ad hoc special rules. So to a small extent your claim is valid. > > That is, "small extent" means "true for integers, but not true for > records". Right? Not quite. It is true for subranges of any discrete base type, i.e. integer, char, boolean, user-defined enumerated types; it is arguable for set types; and is definitely false for all other types. >> One of the nicest things about Ada is how it cleared this mess up. > > Right. I think the Ada "subtype S is Integer range 1..10" is pretty > close to Pascal's "type S = 1..10", but Pascal has no rough equivalent > to Ada's "type T is range 1..10". True? Yes, because Pascal has no way of getting the equivalent of: type T is new ...; -- Bill Findlay chez blueyonder.co.uk