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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,54672440f4ffc24b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!zen.net.uk!dedekind.zen.co.uk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Invalid operator name? Date: Sat, 27 Nov 2004 20:21:50 +0100 Organization: None Message-ID: <1371101.OKryl94uf8@linux1.krischik.com> References: Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1101631123 05 18112 s1E8XvmvufK2qdd 041128 08:38:43 X-Complaints-To: usenet-abuse@t-online.de X-ID: Gzej4UZCYe-SzRq9aSp9y7bUSAizpmhysBKgGfM6gm7c0cYL3CqSZk User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:6574 Date: 2004-11-27T20:21:50+01:00 List-Id: Sandro Magi wrote: > When I try to define my own operator, I receive an "Invalid operator name" > error during compilation. I've found references to operator overloading in > reference materials, but no word whether new operators can be defined > which leads me to believe that it's not possible. > > Is it not possible to define new operators for a custom type? Can we only > override the base operators? Right, only the base operators can be overloaded. See the following list: http://en.wikibooks.org/wiki/Programming:Ada:Operators However, Operators can be overloaded by Return type as well. See some of the options used for "*", where the "*" operator my return a String, Bounded_String or Unbounded_String depending on destination type. http://en.wikibooks.org/wiki/Programming:Ada:Operators:* But beware: to exotic uses for operators make the code more hard to read! With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com