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 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder2.enfer-du-nord.net!gegeweb.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not Date: Sat, 13 Apr 2013 08:49:38 +0200 Organization: cbb software GmbH Message-ID: References: <1gnmajx2fdjju.1bo28xwmzt1nr.dlg@40tude.net> <3gv2jwc95otm.pl2aahsh9ox8.dlg@40tude.net> <1gkxiwepaxvtt$.u3ly33rbwthf.dlg@40tude.net> <1fmcdkj58brky.bjedt0pr39cd$.dlg@40tude.net> <1bj564vat3q1j$.1s4d00rlzx4ux$.dlg@40tude.net> <8bj2k30k7i19.w7ehsldwbf7x.dlg@40tude.net> <1o34nhpfuy6yl$.2orlukd1elr7.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: rHWOzyHApalsT5sEUcbvVQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 4591 Xref: number.nntp.dca.giganews.com comp.lang.ada:181047 Date: 2013-04-13T08:49:38+02:00 List-Id: On Fri, 12 Apr 2013 19:22:36 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:lhy7cs9p0v0t.jmyir4bofwok.dlg@40tude.net... >> On Thu, 11 Apr 2013 18:02:49 -0500, Randy Brukardt wrote: > ... >> Why is it never a good idea to use >> Ada.Strings.Unbounded.Append [a mixed type operation]? > > That's the package that convinced me that mixed operations are never a good > idea. The intent of the mixed operations was to provide string literals, but > the effect was that they are available inconsistently and you're at a real > risk of ambiguity. Moreover, there are cases where you have to convert > things to String just to do an operation on a value of an Unbounded_String. > It's just a bad design. And the solution is to remove Append? What would be a "good" design of Unbounded_String and String such that you never mixed them? Is there any? You missing the main point that whatever difference Unbounded_String and String may have, it is not a semantic difference. Both are different implementations of the same thing. They are mixed right from the start. >>> There's nothing wrong with storing all strings in unbounded UTF-8, for >>> instance, but storing them in a variety of formats will just cause you a >>> huge amount of translation overhead. It's not worth it. >> >> This is what you proposed. I did to avoid translations through support of >> mixed type operations. They do exactly that. > > But you're not eliminating anything. The only way to implement such mixed > operations is via converting one or the other operands to the most general > type. Wrong, a multi-method has a body for each combination of parameters. > In any case, multi-methods don't work given the existing Ada resolution > rules. You want to fix that with preference rules, but those are a > non-starter. You cannot know that without even trying to consider these rules or alternatives to them. > Unless you can clearly prove that you have rules that are completely free of > such effects (which are significant maintenance hazards), the ARG will not > consider them. Sure it will not. >>>>> For instance, I tend to write out the entire name of the conversion >>>>> between string and unbounded string: >>>>> >>>>> Ada.Text_IO.Put_Line (Ada.Strings.Unbounded.To_String (My_Object)); >>>> >>>> Hideous. What kind of information this mess should convey to the reader? >>>> 2/3 of it is noise. My_Object is a string, why Put_Line does not handle >>>> it? >>> >>> It's a "string", not a String. >> >> And *semantically* the difference is? > > Ada is strongly typed; there is currently no such thing as an operation that > will work on any string type. This is why I am asking this question. Where is a semantic difference to justify the choice to draw a firewall between String and Unbounded_String? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de