From: bobduff@world.std.com (Robert A Duff)
Subject: Re: access types and dispatching subprograms
Date: 1996/06/23
Date: 1996-06-23T00:00:00+00:00 [thread overview]
Message-ID: <DtGx9M.F1s@world.std.com> (raw)
In-Reply-To: 4qjqre$44lo@news-s01.ny.us.ibm.net
In article <4qjqre$44lo@news-s01.ny.us.ibm.net>, <kbrun@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
next prev parent reply other threads:[~1996-06-23 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-06-23 0:00 access types and dispatching subprograms kbrun
1996-06-23 0:00 ` Robert Dewar
1996-06-23 0:00 ` Robert A Duff [this message]
1996-06-25 0:00 ` Samuel Tardieu
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox