Re: procedural vs object oriented



Pascal Obry wrote:
Maciej Sobczak a écrit :

In what way is this better or more certain than a dispatching call based
on the tag?

Static analysis is possible in this case.

But static analysis should be possible for the following
program, too, as long as for example `cons` returns references
to object of a known finite set of types derived from T...

At least possible in some defined set of cases, if slightly
more difficult.

procedure dis is

package p is

type T is tagged null record;
type REF is access T'class;

procedure op(x: T);

type D1 is new T with null record;
procedure op(x: D1);

type D2 is new T with null record;
procedure op(x: D2);
end P;

use P;

function cons return REF;

y: REF := cons;
begin
op(y.all);
end;
.