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=-1.2 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8e7ac81a215f128c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> Newsgroups: comp.lang.ada Subject: Re: Using Red-Black Trees Date: Thu, 18 Nov 2010 00:15:11 +0100 Message-ID: References: <2419e829-6f45-4075-9005-b9876beb8aaa@r6g2000vbf.googlegroups.com> <46306fd9-21dc-40df-88e7-fc7e568399a4@k11g2000vbf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Trace: individual.net 52QzuI+65ll/WBN1NR7IHwEPFAZ4NftB6QmbamA3zG/c9ZaIAS Cancel-Lock: sha1:m8gUWd2ZUuEGFwKJi2FYR19A6H8= User-Agent: Opera Mail/10.63 (Win32) Xref: g2news2.google.com comp.lang.ada:16535 Date: 2010-11-18T00:15:11+01:00 List-Id: Yannick Duch=C3=AAne (Hibou57) wrote: > How do you get, with Ada, something similar to what you have with SML,= I > mean multiple structures all implementing a same signature ? > Unfortunately, with Ada, there is no way to do it without tagged/inter= face > types (if a package interface specifies operations, then it must a pac= kage > body which implements, =E2=80=A6 in one way only). There are still separates. Of course, it's a compile time decision and i= t would be part of the build system, not the language itself. > Would be nice to be able with > Ada to have this SML feature: =E2=80=9Cfor that package specification,= use that or > this implementation.=E2=80=9D > I don't see a way to do that using child packages, as the implementati= on > of an operation specified in a package interface cannot be deferred to= a > (or multiple) child package. Child package can only extent. So where's the problem? Provide an abstract type with the proper operati= on set and let the user call a factory function which selects between diffe= rent implementations provided by the different children. This probably introd= uces code bloat, because all possible implementation would need to be include= d in the final executable, but well, you can't have everything, can you? Vinzent. -- = Mail address temporary, use domain to filter.