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!nntp.giganews.com!news.osn.de!diablo2.news.osn.de!feeds.phibee-telecom.net!de-l.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: Fri, 12 Apr 2013 10:17:01 +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: FbOMkhMtVLVmu7IwBnt1tw.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: 4847 Xref: number.nntp.dca.giganews.com comp.lang.ada:181029 Date: 2013-04-12T10:17:01+02:00 List-Id: On Thu, 11 Apr 2013 18:02:49 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:1o34nhpfuy6yl$.2orlukd1elr7.dlg@40tude.net... >> On Wed, 10 Apr 2013 17:07:57 -0500, Randy Brukardt wrote: >> >>> The compiler shouldn't have trouble with inheriting implementations >> >> type Real is tagged record >> Value : Float; >> end record; >> function "+" (L, R : Real) return Real; >> >> type Complex is new Real with record >> Img : Float; >> end record; >> >> How is the compiler supposed to inherit "+"? > > Easy, it uses the defined constructor. You must be joking. How the compiler knows how to add complex numbers? type Polar_Complex is new Real with record Angle : Float; end record; This one too? > Of course, I don't think Float and Complex have enough in common for this > sort of derivation to make sense. (The only commonality between float "*" > and complex "*" is the name.) The commonality is called "field": http://en.wikipedia.org/wiki/Field_%28mathematics%29 >>>> You don't make language design dependent and promoting bad practices. >>> >>> If you are starting with a blank page, you're right. If you are building >>> on 30+ years of practice, even "bad practice" has to be taken into account. >> >> Nonsense. Bad practice is bad. Longer it lasts bigger is the damage. > > Not nonsense. You can't break existing programs if you expect people to > upgrade. Show me a program that gets broken by introducing untagged classes. >> But if performance is your concern, you must be the first to go for >> multi-methods, because this is the only way to define type-specific >> operations and to have different representations for different members of >> the hierarchy. Your proposal was to render all strings as >> Wide_Wide_String. And you tell me about efficiency? > > It is never a good idea to mix types in a program: String shouldn't be mixed > with Wide_String, Float with Complex, or Integer with Float. In the rare > case when you need to do so, you should write an explicit conversion. Ergo, performance is not your concern when it is about the Principle. But you tried to justify that very principle with performance in first place. So, we are the to the square one. Why is it never a good idea to use Ada.Strings.Unbounded.Append [a mixed type operation]? > 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. >>> 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? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de