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.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Sat, 29 Mar 2014 10:44:53 +0100 Organization: cbb software GmbH Message-ID: <8bhozh836pyt$.1qctlysud0s2q$.dlg@40tude.net> References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: KX5nm0jf7du4gHjHR6mb/g.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: 3341 Xref: number.nntp.dca.giganews.com comp.lang.ada:185404 Date: 2014-03-29T10:44:53+01:00 List-Id: On Fri, 28 Mar 2014 16:27:09 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:o4o5ao9k7hz9.l7ebk8qxfv32.dlg@40tude.net... >> On Thu, 27 Mar 2014 16:50:20 -0500, Randy Brukardt wrote: > ... >> Real issue: Multi-methods (String vs String) and full multiple dispatch >> (String vs Character) > > That's an alternative, but the question is whether that can be implemented > with less overhead than the scheme I suggested. I believe the answer is no, > at least within generalized string packages (which hopefully will become the > norm for new string operations in Ada). If and only if the generalized packages would define operations class-wide. The idea is to rather make them primitive operations, so that a vendor (if he wanted to) could provide type-specific implementation for the cases of major interest, e.g. overriding function "&" (L, R : String) return String; instead of inheriting (covariantly) ineffective parent's function "&" (L, R : Root_String_Type) return Root_String_Type; Root_String_Type would be an equivalent of Wide_Wide_String or UTF8_String or any other full Unicode character set string. >> To reiterate the point. The implementation of strings in Ada is all OK, it >> is the interface to this implementation which sucks. > > Right, but that manifests itself in duplicated and overly restrictive > packages, which would have to be reworked in order to use a more general > interfaces. (Ada.Strings.Bounded and Ada.Strings.Unbounded in particular > have overloaded operations that would make everything ambiguous if not > eliminated.) If all string types are members of single class, then all corresponding overloaded operations are primitive operations on the class. Overloading of overridden operations in guaranteed unambiguous. That is when you build a new hierarchy of string types. Whether Unbounded_String should become a member of this new hierarchy or be replaced there with a new type is another question. Of course The former would be greatly preferable. This requires yet another feature Ada lacks - interface inheritance. Unbounded_String must drop parent's implementation/representation and inherit only the interface. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de