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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: feedback asked on dab-decoder software in Ada Date: Sat, 24 Sep 2016 23:27:55 +0200 Organization: A noiseless patient Spider Message-ID: References: <52cfa89e-7e4f-48f6-93b4-d559ea001d82@googlegroups.com> <87oa3ph71j.fsf@adaheads.sparre-andersen.dk> <0dbca7f0-791b-4eee-99fa-ce5fe2a71de6@googlegroups.com> <2d49e17f-c57e-451e-a506-96f963b3cf61@googlegroups.com> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 24 Sep 2016 21:27:46 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="210b687a41a8473716f931da994f236f"; logging-data="4795"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DWtgqfiQtRGntNyM/QKGwWRIwPu+I9bE=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: <2d49e17f-c57e-451e-a506-96f963b3cf61@googlegroups.com> Cancel-Lock: sha1:W6CQ3qDif6AABreLkNnrAZZQQaU= Xref: news.eternal-september.org comp.lang.ada:31879 Date: 2016-09-24T23:27:55+02:00 List-Id: On 24.09.16 20:38, jan van katwijk wrote: > I looked into the abundant use of access types. In the front end (i.e. the ofdm processing part) some access varaibles could be eliminated and replaced by "normal" variables. In the backend, however, quite some dynamic choices determine which part of the program should be active (e.g. MP2 decoding or MP4 decoding). I'm guessing only, not having looked closely, but just in case: the way to specify dynamic choice of types etc. is by declaring variables and parameters to be of type T'Class, similar to C++'s T&: struct S {}; bool operator==(const S& left, const S& right) { return true; }; /// calling op `foo` for parameters of any type derived from T. S f(const T& thing) { return thing->foo(1); } class T { public: T() {} virtual S foo(int) const = 0; }; /// T1, T2 types derived from T int main() { T1 x = T1(); T2 y = T2(4); return (f(x) == f(y)); } package N is type S is record null; end record; type T is abstract tagged null record; function foo(thing: T; X : Natural) return S is abstract; -- T1, T2 types derived from T end N; with N; -- calling op `foo` for parameters of any type derived from T. function F(Thing: N.T'Class) return N.S is begin return Thing.Foo(1); end F; with N, F; use N; function Main return Integer is X : T1; Y : T2 := Construct (4); begin return Boolean'Pos (F(X) = F(Y)); end Main; -- "HOTDOGS ARE NOT BOOKMARKS" Springfield Elementary teaching staff