From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: Tell whether a primitive subprogram was overridden Date: Tue, 19 Aug 2014 16:45:54 +0300 Organization: Aioe.org NNTP Server Message-ID: References: <1nlld44wut4kf.1l1mtjf7durro.dlg@40tude.net> NNTP-Posting-Host: AnnUDmZwVERVUXyHDyOl5A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.13.3 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:188558 Date: 2014-08-19T16:45:54+03:00 List-Id: 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