From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Defining a binary operator between function access types: Is it possible?
Date: Thu, 16 Oct 2008 16:26:49 +0200
Date: 2008-10-16T16:26:49+02:00 [thread overview]
Message-ID: <1fatt8rskw7bv.1ig3fzdpsxpzn.dlg@40tude.net> (raw)
In-Reply-To: fed9902a-28f0-4e70-a427-4773b20aae47@p49g2000hsd.googlegroups.com
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
next prev parent reply other threads:[~2008-10-16 14:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-16 13:34 Defining a binary operator between function access types: Is it possible? soychangoman
2008-10-16 14:26 ` Dmitry A. Kazakov [this message]
2008-10-16 14:29 ` Adam Beneschan
2008-10-16 22:18 ` Robert A Duff
2008-10-16 15:14 ` Jacob Sparre Andersen
2008-10-17 7:10 ` Defining a binary operator between function access types: Is it anon
2008-10-21 6:46 ` Defining a binary operator between function access types: Is it possible? Ivan Levashew
2008-10-21 13:17 ` soychangoman
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox