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-20 12:26:06 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: 20 May 2002 12:26:06 -0700 Organization: http://groups.google.com/ Message-ID: References: <3CE81644.D3B7CE25@acm.org> NNTP-Posting-Host: 128.102.146.44 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1021922766 24271 127.0.0.1 (20 May 2002 19:26:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 20 May 2002 19:26:06 GMT Xref: archiver1.google.com comp.lang.ada:24431 Date: 2002-05-20T19:26:06+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 10:25 PM > Subject: Re: user-defined type conversion > > > > > Yes, I meant "arg" rather than "feet", and I don't think it's an > > infinite resursion. The "inches" function takes a "feet" argument, > > whereas the call of "inches" within it takes a "float" argument. > > That's two different functions. > > > As has been pointed out, the call of "inches" within takes an argument of > _any numeric type_, not just float, and it is this which makes the call > ambiguous. > > > I still don't see why I shouldn't be able to make my own type/unit > > conversion that has the same simple syntax as the built-in type > > conversions. Until I do, I consider it a minor deficiency of the > > language. > Do you understand now? Yes, I understand now. But I think Ada should have been designed to first check for a user-defined type conversion before using a compiler-generated conversion. That would solve the ambiguity problem and allow users to create their own type/unit conversions with the same syntax as built-in type conversions. That, in turn, would allow developers to create simple and elegant type/unit system for each particular application.