comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: Tell whether a primitive subprogram was overridden
Date: Mon, 18 Aug 2014 19:29:48 -0600
Date: 2014-08-18T19:29:48-06:00	[thread overview]
Message-ID: <oMxIv.6207$Wt5.4903@fx01.iad> (raw)
In-Reply-To: <0b8124b3-5d31-4c2b-a27e-64795625c7f0@googlegroups.com>

On 18-Aug-14 17:52, Adam Beneschan wrote:
> On Monday, August 18, 2014 4:41:24 PM UTC-7, Victor Porton wrote:
>> Is it possible to determine whether for a given object of type T'Class a
>> primitive subprogram F was overridden (not the same as for type T)?
>>
>> I would like this check for efficiency reasons, not to pass it to a callback
>> if the default "null" operation was not overridden.
>
> No, Ada doesn't provide a mechanism for this.
> I don't know of a language that does, although in some languages you might be
> able to use "reflection" to squeeze the information out, but with some difficulty.
>
> The best solution that I can think of is to add a function to T:
>
>      function F_Does_Something_Useful (Obj : T) return boolean;
>
> This would be False for T, but for any derived type where you override F,
> you'd also override this function to make it return True.
>
>                              -- Adam
>

You *MIGHT* be able to do it w/ LISP; the homoiconic nature and 
first-class functions should combine quite well with the OOP framework 
to allow such a query.

  parent reply	other threads:[~2014-08-19  1:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 23:41 Tell whether a primitive subprogram was overridden Victor Porton
2014-08-18 23:52 ` Adam Beneschan
2014-08-18 23:57   ` Victor Porton
2014-08-19  9:50     ` Simon Wright
2014-08-19  1:29   ` Shark8 [this message]
2014-08-19  7:31 ` Dmitry A. Kazakov
2014-08-19 13:45   ` Victor Porton
2014-08-19 13:57     ` Dmitry A. Kazakov
2014-08-19 15:54       ` Victor Porton
replies disabled

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