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-21 21:32:56 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: 21 May 2002 21:32:56 -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 1022041976 9068 127.0.0.1 (22 May 2002 04:32:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 22 May 2002 04:32:56 GMT Xref: archiver1.google.com comp.lang.ada:24500 Date: 2002-05-22T04:32:56+00:00 List-Id: 18k11tm001@sneakemail.com (Russ) wrote in message news:... > "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 > > > > > 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. After reading the replies here and thinking about it a bit more, I have come to the conclusion that it is not such a great idea after all to have user-defined type conversions with the same syntax as built-in conversions. The problem is that it is error prone. I could carelessly try to invoke my user-defined conversion on a type that I have not defined it for, and the compiler would not be able to detect the error (because it would just use the built-in conversion). There's hope for me after all.