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,FREEMAIL_FROM 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-19 11:29:28 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: user-defined type conversion Date: 19 May 2002 11:29:28 -0700 Organization: http://groups.google.com/ Message-ID: References: NNTP-Posting-Host: 63.194.87.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1021832968 23013 127.0.0.1 (19 May 2002 18:29:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 19 May 2002 18:29:28 GMT Xref: archiver1.google.com comp.lang.ada:24379 Date: 2002-05-19T18:29:28+00:00 List-Id: "David C. Hoos, Sr." wrote in message news:... > ----- Original Message ----- > From: "Russ" <18k11tm001@sneakemail.com> > Newsgroups: comp.lang.ada > To: > Sent: May 19, 2002 2:44 AM > Subject: user-defined type conversion > > > > The problem is that I am not allowed to use the name inches for the > > conversion function because it is already used for the type name. It > > seems that the name should be overloadable for both the type and the > > conversion function. Is there any way around this? > > 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! It seems to me that I should be able to do it the same way it is done for the built-in types (float, integer, etc.). C++ allows that nicely. > The ususl way to do this is to name the conversion function with a > leading "To_", e.g., To_Inches.