comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: Tell whether a primitive subprogram was overridden
Date: Tue, 19 Aug 2014 16:45:54 +0300
Date: 2014-08-19T16:45:54+03:00	[thread overview]
Message-ID: <lsvkem$sh4$1@speranza.aioe.org> (raw)
In-Reply-To: 1nlld44wut4kf.1l1mtjf7durro.dlg@40tude.net

Dmitry A. Kazakov wrote:
> On Tue, 19 Aug 2014 02:41:24 +0300, 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)?
> 
> It is always overridden even if inherited. Purely formally, since the type
> is different, e.g. S derived from T, then it cannot be the same
> subprogram.
> [Technically it can have some additional trampoline code as well.]
> 
>> I would like this check for efficiency reasons, not to pass it to a
>> callback if the default "null" operation was not overridden.
> 
> You mean that a check would be more efficient than a dispatching call? I
> don't think there would be much difference, except the case when the
> subprogram has a long list of additional arguments or computed arguments.
> That is usually the case when doing tracing stuff. In that case you could
> think of some lazy parameter evaluation schema or upfront checks as Adam
> suggested.

No. I haven't described exactly what I do.

I need to register (by calling a C function) a C wrapper around a method of 
my class as a callback subprogram. If my method is null, it is not necessary 
to register it and the C code would not call it.

-- 
Victor Porton - http://portonvictor.org


  reply	other threads:[~2014-08-19 13:45 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
2014-08-19  7:31 ` Dmitry A. Kazakov
2014-08-19 13:45   ` Victor Porton [this message]
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