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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f127842852d2f03a X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: About conversions Date: 2000/11/20 Message-ID: <8vbfds$dih$1@nnrp1.deja.com>#1/1 X-Deja-AN: 695772963 References: <8vb0h9$1ou$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x51.deja.com:80 (Squid/1.1.22) for client 205.232.38.240 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Nov 20 15:19:31 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-11-20T00:00:00+00:00 List-Id: In article , "Ken Garlington" wrote: <> > In your example, you have a > procedure P that expects values of type Integer, you convert > your Typ value > to an Integer value before calling P, so everything is > consistent. No, that's quite wrong. Ken misread the example. This is indeed the "weird" case where a type conversion is used on an OUT parameter. Even someone who understands all the stuff about type conversions in general can be puzzled at this peculiar use. The deal here is that the conversion happens AFTER the call in the OPPOSITE direction from what it looks like. So if the call says p (10,20,integer(c)); the actual effect is that the function computes something of type Integer and puts it in the output parameter. This value is then converted FROM integer TO type "typ" and stored in C. How's that for strange? The conversion is exactly "backwards". In the case of an IN OUT parameter, you get two conversions, one the way that it looks (and to which Ken was referring incorrectly above, not having noticed the OUT keyword), and one the peculiar opposite direction. Why is this feature in the language? It's really there to provide an easy explanation for what happens in the case of derived types. I think it's actually misguided, because although it makes the explanation of derived types easier, it introduces a bogus misleading feature into the language that is of very little practical use and which causes a lot of confusion, even among people who know Ada well! Robert Dewar Sent via Deja.com http://www.deja.com/ Before you buy.