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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,79bbf7e359159d0d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-10 07:23:14 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!hub.org!hub.org!newsfeed.mesh.ad.jp!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison Sender: usenet@www.newsranger.com References: <3ACDB29E.45B91316@earthlink.net> <9ao1if$cq9$1@taliesin.netcom.net.uk> <3ACFC902.115624A1@mindspring.com> <3AD2AF50.6B5DD470@mida.se> Subject: Re: newbie can't get exceptions to work! Message-ID: Date: Tue, 10 Apr 2001 14:18:19 GMT NNTP-Posting-Host: 209.208.22.130 X-Complaints-To: abuse@newsranger.com X-Trace: www.newsranger.com 986912299 209.208.22.130 (Tue, 10 Apr 2001 10:18:19 EDT) NNTP-Posting-Date: Tue, 10 Apr 2001 10:18:19 EDT Organization: http://www.newsranger.com Xref: supernews.google.com comp.lang.ada:6708 Date: 2001-04-10T14:18:19+00:00 List-Id: In article <3AD2AF50.6B5DD470@mida.se>, Mats Karlssohn says... > >Could we get the language to handle dispatching calls that in some of >the >cases dispatches to a function and in some cases just get the return >value >from one array *big smile* ? I've quite recently implemented a hirarchy >with these properties by wrapping the arrays in functions. It would be >nice if the compiler could generate the wrappers by itself. But maybe Interesting example. :-) First off, I don't think it would be consistent to do this kind of thing unless you also allowed an array to be a tagged type (not a component, but a tagged type in and of itself). Otherwise, what's the syntax for deciding what array to use? There may be some neat way of doing that, but I don't see it. But let's pretend that wasn't an issue (now we're off in never-never land of course). In other posts I've been equating array indexing to an automaticly pragma-inlined canned mapping function. Now I think dispatching can be split into two cases: dynamic and static. Static dispatch is just the insertion of the proper type's function call into the generated code. It shouldn't be too big of a deal for a compile to insert the indexing code rather than a function call when appropriate. For dynamic dispatch, the compiler essentially generates a big case statement, based on the object's tag, where each branch contains a function call. You could also think of it as a jump (to subroutine) table. Now if the compiler is just doing a table lookup and JSR'ing to the result, then there's going to be a subroutine call anyway. So you aren't really buying anything by not having to write that function that does nothing but index into an array. However, if it actually is a big case statement, then there would be nothing wrong with having an inlined routine on one of the branches. In that case it would be doable. (Is pragma inline allowed for a dispatching call?) --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com