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 01:13:46 +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 YKpIHzFPhSK2NxQMNbsqwAoPBASDbb24HrH5K86c3R5t4xRm9h Cancel-Lock: sha1:3F4xWJu6NmIAuKoaJdpNJK+NFfc= User-Agent: Opera Mail/10.63 (Win32) Xref: g2news2.google.com comp.lang.ada:16537 Date: 2010-11-18T01:13:46+01:00 List-Id: Yannick Duch=C3=AAne (Hibou57) wrote: > Le Thu, 18 Nov 2010 00:15:11 +0100, Vinzent Hoefler > <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> a =C3=A9crit: >> >> There are still separates. Of course, it's a compile time decision an= d it >> would be part of the build system, not the language itself. > You can have only one at a time. If you select an implementation, you > select it system-wide, and you cannot select one for that usage and > another for another usage in the same system. Sure. I wouldn't propose it as a perfect solution. But we use that featu= re quite often to provide different implementations depending on the target= . So it doesn't seem totally useless in the given context. > The problem is that this is a lack of orthogonality, which is surprisi= ngly > an Ada famous feature (Ada forget this one). This is the same issue as= the > one you get with language with which classes is the only way to achiev= e > encapsulation. With these, you end to use classes when you do not need= it > at the first place and indeed needed package instead. Here, I would li= ke > to be able to do something which has nothing at all to deal with > polymorphism, and I cannot do it without polymorphism because Ada do n= ot > provide orthogonality here. Well, isn't providing different implementations with a common interface equivalent to "polymorphism"? I mean, if you don't look at the implement= ation how can you tell the difference? ;) For instance, instead of using an abstract tagged type and dispatching y= ou could also use "delegation" (I hope that's the right term) to different implementations under a common interface without reverting to tagged typ= es. I still would consider that polymorphism (actually, we do that with the communication subsystem, the implementation decides at run-time which so= rt of communication is the most efficient, depending on the physical location of sender and receiver). > implementation. In less words, would like Ada package specification to= be > more abstract; just like you can have multiple entities, all instance = of a > type, would be nice to be able to have multiple implementations, all > instance of a specification. You mean like - let me quickly think of a syntax ... - non-Ada, of cours= e - -- 8< spec -- package Foo -- Some notion to hint the compiler there may be different bodies. select Implementation_Choice is (Binary_Tree, Linked_List); is type Bar is ...; procedure Implementation_Specific (X : Bar) with Implementation_Choi= ce; procedure Common (X : Bar); end Foo; -- 8< -- -- 8< body -- package body Foo is procedure Foobar (X : Bar) case Implementation_Choice when Binary_Tree =3D> is ... begin ... binary tree. end Foobar (Binary_Tree); when Linked_List =3D> is ... begin ... linked list. end Foobar (Linked_List); end case; end Foobar; end Foo; -- 8< -- -- 8< usage -- with Foo; for Foo.Implementation_Choice use Foo.Binary_Tree; -- 8< -- Vinzent. -- = Mail address temporary, use domain to filter.