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-19 01:54:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stueberl.de!newspeer1-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "martin.m.dowie" Newsgroups: comp.lang.ada References: Subject: Re: user-defined type conversion X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <2LJF8.28233$Iv.3346296@news6-win.server.ntlworld.com> Date: Sun, 19 May 2002 09:54:17 +0100 NNTP-Posting-Host: 62.253.10.15 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1021798462 62.253.10.15 (Sun, 19 May 2002 09:54:22 BST) NNTP-Posting-Date: Sun, 19 May 2002 09:54:22 BST Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:24369 Date: 2002-05-19T09:54:17+01:00 List-Id: "Russ" <18k11tm001@sneakemail.com> wrote in message news:bebbba07.0205182344.3602f20a@posting.google.com... > I am experimenting with a simple type system for physical units. > Suppose, for example, I have types for inches and feet, and I wish to > write an explicit conversion: > > type inches is new float; > type feet is new float; > > function inches ( arg: feet ) return inches is > begin > return inches ( 12.0 * float(feet) ); > end inches; > > 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? Common approaches I've seen over the years are: 1. Change the name of the function to "To_Inches" 2. Change the type name to "An_Inch" or "Inches_Type"