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 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!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Defining a binary operator between function access types: Is it possible? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Thu, 16 Oct 2008 16:26:49 +0200 Message-ID: <1fatt8rskw7bv.1ig3fzdpsxpzn.dlg@40tude.net> NNTP-Posting-Date: 16 Oct 2008 16:26:49 CEST NNTP-Posting-Host: 9816f4d2.newsspool2.arcor-online.net X-Trace: DXC=9Fod``;=NhA=8m7nZkdN^@A9EHlD;3YcB4Fo<]lROoRA4nDHegD_]RERen\hR0>b`IDNcfSJ;bb[EFCTGGVUmh?DLK[5LiR>kgBbEWHa?O5iAH X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:2422 Date: 2008-10-16T16:26:49+02:00 List-Id: On Thu, 16 Oct 2008 06:34:30 -0700 (PDT), soychangoman@gmail.com wrote: > 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 cannot create a new subprograms and return it from another subprogram. To have the effect of an interpreted language you have to define corresponding first-class types. For example: type Operation is abstract tagged private; function Evaluate (F : Operation; X : Real) return Real is abstract; ... type Squaring is new Operation with null record; overriding function Evaluate (F : Squaring; X : Real) return Real; Square : constant Squaring; ... type Composed_By_Plus is new Operation with private; function "+" (L, R : Operation'Class) return Composed_By_Plus; overriding function Evaluate (F : Composed_By_Plus; X : Real) return Real; ... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de