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: a07f3367d7,73cb216d191f0fef X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.20.105 with SMTP id m9mr3651092wie.5.1366082684320; Mon, 15 Apr 2013 20:24:44 -0700 (PDT) Path: hg5ni6325wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.teledata-fn.de!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not Date: Wed, 10 Apr 2013 09:30:15 +0200 Organization: cbb software GmbH Message-ID: <1efcte840sxe6$.160qi4yiej6en.dlg@40tude.net> References: <1gkxiwepaxvtt$.u3ly33rbwthf.dlg@40tude.net> <1fmcdkj58brky.bjedt0pr39cd$.dlg@40tude.net> <1bj564vat3q1j$.1s4d00rlzx4ux$.dlg@40tude.net> <4hzv51v872q2$.1imijbwd7heqm$.dlg@40tude.net> <1htu9idmcci7x.1vr9eafeivqah$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2013-04-10T09:30:15+02:00 List-Id: On Tue, 9 Apr 2013 17:57:55 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:ihi0ajan1ehu.iplgjkwsfpii.dlg@40tude.net... > ... >> Now consider Ada.Strings.Unbounded. It has a whole lot of mixed string >> type operation declared: Append, "&", "=", "<", ">", ">=", "<=". > > Yes, a horrible mistake. It prevents Ada.Strings.Unbounded from ever having > any literals, because they could never have a unique type. Overloading is what leads to problems. There are ways to resolve it. One approach could be literal extension. Usually it is thought that Wide_Character is a constrained Wide_Wide_Character and Character is a constrained Wide_Character: Wide_Wide_Character -> Wide_Character -> Character This cases corresponding values to overlap: 'A' is either Wide_Wide_Character or Wide_Character or Character One could consider an alternative derivation based on enumeration extension: Character -> Wide_Character -> Wide_Wide_Character That would remove overloading of literals. 'A' will be Character only. The reason why this did not work in Ada was due to lack of multi-methods. Ada character/string operations were all overloaded, so in order to make them work with literals, one had to overload literals as well. With multi-methods there will be no need to overload literals anymore: X : Wide_Character := 'A'; -- This is OK with multi-method Resolved to procedure ":=" (Left : in out Wide_Character; Right : Character); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de