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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bd50112c03f1f521 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Defining a binary operator between function access types: Is it possible? Date: 16 Oct 2008 17:14:36 +0200 Organization: Jacob's private Usenet server Sender: sparre@jspa-nykredit Message-ID: <871vygd12b.fsf@nbi.dk> References: NNTP-Posting-Host: 79.138.241.50.bredband.3.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: jacob-sparre.dk 1224170079 13414 79.138.241.50 (16 Oct 2008 15:14:39 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 16 Oct 2008 15:14:39 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Xref: g2news1.google.com comp.lang.ada:2425 Date: 2008-10-16T17:14:36+02:00 List-Id: soychangoman@gmail.com writes: > I'm trying to define a binary operator between function access types > that returns the access to the function that is the binary operator > acting on both functions. You can't do that quite like that. The first idea which springs to mind for solving this kind of problem is to make a hack using tagged types ... type Abstract_Binary_Operation is abstract tagged null record; function Operate (O : Abstract_Binary_Operation; L, R : Real) return Real is abstract; type Composed_Addition (FL, FR : access function (X : Real) return Real) is new Abstract_Binary_Operation with null record; function Operate (O : Composed_Addition; L, R : Real) return Real is begin return O.FL (L) + O.FR (R); end Operate; Just a wild thought! Not tested! Greetings, Jacob -- People in cars cause accidents. Accidents in cars cause people.