comp.lang.ada
 help / color / mirror / Atom feed
* Defining a binary operator between function access types: Is it possible?
@ 2008-10-16 13:34 soychangoman
  2008-10-16 14:26 ` Dmitry A. Kazakov
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: soychangoman @ 2008-10-16 13:34 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-10-21 13:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox