comp.lang.ada
 help / color / mirror / Atom feed
From: soychangoman@gmail.com
Subject: Defining a binary operator between function access types: Is it possible?
Date: Thu, 16 Oct 2008 06:34:30 -0700 (PDT)
Date: 2008-10-16T06:34:30-07:00	[thread overview]
Message-ID: <fed9902a-28f0-4e70-a427-4773b20aae47@p49g2000hsd.googlegroups.com> (raw)

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 := square'Access;
  f2_acc := cubic'Access;

  -- f3_acc := 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ías Niklison



             reply	other threads:[~2008-10-16 13:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-16 13:34 soychangoman [this message]
2008-10-16 14:26 ` Defining a binary operator between function access types: Is it possible? Dmitry A. Kazakov
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