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 20:25:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!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 20:25:22 -0700 Organization: http://groups.google.com/ Message-ID: References: <3CE81644.D3B7CE25@acm.org> NNTP-Posting-Host: 63.194.87.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1021865123 1434 127.0.0.1 (20 May 2002 03:25:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 20 May 2002 03:25:23 GMT Xref: archiver1.google.com comp.lang.ada:24399 Date: 2002-05-20T03:25:23+00:00 List-Id: Jeffrey Carter wrote in message news:<3CE81644.D3B7CE25@acm.org>... > Russ wrote: > > > > 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; > > Assuming you meant Arg rather than Feet in the return statement, it > appears that this function attempts infinite recursion. This confusion > among the multiple meanings of "inches" might be part of why the > language does not allow this. 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. 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.