From: "(see below)" <yaldnif.w@blueyonder.co.uk>
Subject: Re: Easy question about Character manipulation
Date: Wed, 31 Jan 2007 03:07:36 +0000
Date: 2007-01-31T03:07:36+00:00 [thread overview]
Message-ID: <C1E5B878.92190%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: wccwt346uhg.fsf@shell01.TheWorld.com
On 30/1/07 22:05, in article wccwt346uhg.fsf@shell01.TheWorld.com, "Robert A
Duff" <bobduff@shell01.TheWorld.com> 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
<surname><forename> chez blueyonder.co.uk
next prev parent reply other threads:[~2007-01-31 3:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-29 20:01 Easy question about Character manipulation mark
2007-01-29 20:17 ` Dmitry A. Kazakov
2007-01-29 21:30 ` Georg Bauhaus
2007-01-30 0:51 ` (see below)
2007-01-30 1:43 ` Georg Bauhaus
2007-01-30 2:09 ` (see below)
2007-01-30 20:18 ` Robert A Duff
2007-01-30 21:07 ` (see below)
2007-01-30 22:05 ` Robert A Duff
2007-01-31 3:07 ` (see below) [this message]
2007-01-31 18:11 ` Jeffrey R. Carter
2007-01-31 21:02 ` (see below)
2007-01-31 23:01 ` Robert A Duff
2007-01-31 23:23 ` (see below)
2007-01-31 23:46 ` Jeffrey R. Carter
2007-02-01 0:07 ` (see below)
2007-01-30 21:08 ` Dmitry A. Kazakov
2007-01-31 16:54 ` Georg Bauhaus
2007-01-31 17:24 ` (see below)
2007-01-30 12:28 ` Martin Krischik
2007-01-30 17:50 ` Jeffrey R. Carter
2007-01-30 20:24 ` Robert A Duff
2007-01-30 21:12 ` Dmitry A. Kazakov
2007-01-30 21:39 ` Robert A Duff
2007-01-31 10:55 ` Dmitry A. Kazakov
2007-01-31 11:22 ` Martin Krischik
2007-01-31 18:14 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox