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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2045dce6c7815bab X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: access types and dispatching subprograms Date: 1996/06/23 Message-ID: #1/1 X-Deja-AN: 161724429 references: <4qjqre$44lo@news-s01.ny.us.ibm.net> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-06-23T00:00:00+00:00 List-Id: In article <4qjqre$44lo@news-s01.ny.us.ibm.net>, wrote: > procedure disp(p: T_p); You want "p: access T" here. Access parameters, which are of an anonymous access type, allow dispatching. A named access type, such as T_p, does not. > procedure disp(p: T1_p); And "p: access T1" here. > procedure do_dispatch is > classp: TC_p := new T1; > begin > disp(classp); -- this call won't dispatch, instead it causes > -- a compiler error. what's wrong? With the above changes, this will dispatch. The reason you get a compile-time error is because we tried to set up the rules so that if you *think* you are calling a dispatching operation, but you are not, you will get a compile-time error if you call it in a dispatching way. As opposed to doing the unexpected thing at run time. This case is one example of that. - Bob