comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Object-Oriented style question
Date: Tue, 10 Jan 2012 09:34:22 +0100
Date: 2012-01-10T09:34:22+01:00	[thread overview]
Message-ID: <1vvet6wyyzd7c$.36y88vkv8wfh$.dlg@40tude.net> (raw)
In-Reply-To: 2c213807-20cd-4b06-b2fa-c27827c9b747@f11g2000yql.googlegroups.com

On Mon, 9 Jan 2012 14:34:17 -0800 (PST), Adam Beneschan wrote:

> I think there are very good reasons for using anonymous access-
> subprogram parameters.

No. In most cases access-to-subprogram parameter should have been a
subprogram parameter, if Ada only supported that.

If you meant rather that anonymous access to subprogram is better than
named one, that is also debatable. Anonymous access-to-subprogram is weakly
typed in the sense that it wrongly presumes that all subprograms of same
parameter profile are exchangeable = belong to compatible subtypes.

That is certainly not a strong typed approach. It is a hack necessary
*because* subprograms in Ada have no explicit types.

If they had:

   type procedure Differentiable (X : Float) return Float;
   type procedure Non_Differentiable (X : Float) return Float;

   Sine_Waveform : Differentiable; -- Sine is differentiable
   Square_Waveform : Non_Differentiable; -- Squares are non-differentiable

   procedure Differentiate (F : Differentiable);
      -- You cannot pass squares here

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2012-01-10  8:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 12:45 Object-Oriented style question Georg Bauhaus
2012-01-08 12:52 ` Simon Wright
2012-01-08 13:25   ` Dmitry A. Kazakov
2012-01-08 14:18 ` Robert A Duff
2012-01-08 20:32   ` Martin Dowie
2012-01-08 20:52     ` Robert A Duff
2012-01-09 22:34   ` Adam Beneschan
2012-01-09 23:21     ` Robert A Duff
2012-01-10  8:34     ` Dmitry A. Kazakov [this message]
2012-01-09  8:55 ` Maciej Sobczak
2012-01-09 23:58   ` Georg Bauhaus
2012-01-10  8:47     ` Maciej Sobczak
2012-01-10 10:27       ` Dmitry A. Kazakov
2012-01-10 12:27       ` Georg Bauhaus
2012-01-11  8:54         ` Maciej Sobczak
2012-01-10 21:26       ` Randy Brukardt
2012-02-08 12:23 ` Yannick Duchêne (Hibou57)
2012-02-08 12:39 ` Yannick Duchêne (Hibou57)
replies disabled

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