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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bd50112c03f1f521,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!p49g2000hsd.googlegroups.com!not-for-mail From: soychangoman@gmail.com Newsgroups: comp.lang.ada Subject: Defining a binary operator between function access types: Is it possible? Date: Thu, 16 Oct 2008 06:34:30 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 190.246.68.56 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1224164071 7910 127.0.0.1 (16 Oct 2008 13:34:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 16 Oct 2008 13:34:31 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p49g2000hsd.googlegroups.com; posting-host=190.246.68.56; posting-account=qyu9oAoAAADnlcmgaGLAx2wCGPoJM9US User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-2),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2420 Date: 2008-10-16T06:34:30-07:00 List-Id: 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. Let's put it a bit clearer: ----------- procedure operating_on_access is type function_access is access function ( x : Real) return Real; function "+" (f1 : function_access; f2 : function_access) return function_access is begin -- The question is what to put here return null; end "+" funcion square (x : Real) return Real is begin return x**2; end square; funcion cubic (x : Real) return Real is begin return x**3; end square; f1_acc, f2_acc, f3_acc : function_access; begin f1_acc :=3D square'Access; f2_acc :=3D cubic'Access; -- f3_acc :=3D f1_acc + f2_acc; -- the idea is that ' f3_acc.all ( x ) ' and ' square (x) + cubic(x) ' are equivalent end operating_on_access; ----- Thanks in advance Mat=EDas Niklison