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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,89814ab9e757697a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-21 02:16:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!pec-10-119.tnt1.hh2.uunet.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: user-defined type conversion Date: Tue, 21 May 2002 11:18:07 +0200 Message-ID: References: <3CE8154B.E28B7880@acm.org> NNTP-Posting-Host: pec-10-119.tnt1.hh2.uunet.de (149.225.10.119) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1021972560 25638439 149.225.10.119 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:24451 Date: 2002-05-21T11:18:07+02:00 List-Id: On Sun, 19 May 2002 21:12:56 GMT, Jeffrey Carter wrote: >Russ wrote: >> >> "David C. Hoos, Sr." wrote in message news:... >> > No, because a type conversion has the same syntax as a function, so >> > there's no way to "read the programmer's mind," as to what he intended. >> >> Type conversion IS a function! > >Are you sure? Given > >type Real is new Float; > >F : Float; >R : Real; > >a statement such as > >R := Real (F); > >probably has no code generated for the type conversion. No function >call, no inline expansion, nothing. So what? A function that does nothing is still a function. More interesting is the following: procedure Increment (X : in out Float); I : Integer := 1; begin Increment (Float (I)); Here Float is a pair of functions: To_Float and From_Float and Increment (Float (..)) is a composition: To_Float o Increment o From_Float --- Regards, Dmitry Kazakov www.dmitry-kazakov.de