comp.lang.ada
 help / color / mirror / Atom feed
* Package name qualifier on function?
@ 1998-02-06  0:00 Lane Wimberley
  1998-02-06  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 2+ messages in thread
From: Lane Wimberley @ 1998-02-06  0:00 UTC (permalink / raw)



I am new to the world of Ada programming.  I have come across the
following and my Rational VADS compiler has no trouble with it.

-- code somebody else wrote...
-- Foo spec:
package Foo is
  type internalfoothing is private;
  function create return internalfoothing;
private
  type somethingelse;
  type somethingelseptr is access somethingelse;
  type internalfoothing is new somethingelseptr;
end Foo;

-- spec of different package that withs Foo package:
with Foo;
package Bar is 
  type FooThing is private;
private
  type FooThing is new Foo.internalfoothing;
end Bar;

-- body of different package 
package body Bar is

function create(param : someparamtype) returns FooThing is 
  newfoothing : FooThing;
begin
  newfoothing := create;  -- why is this OK?
  return newfoothing;
end create;

end Bar;

As the comment indicates, I can't figure out why the compiler
accepts the invocation of "create" without any package qualifier.
I would have expected to see "Foo.create"  Also, why do I get no
complaint about the fact that "create" returns an InternalFooThing
yet newfoothing is of type FooThing?

Any help MUCH appreciated!

-- 
Lane Wimberley
Microelectronics and Computer Technology Corporation
Austin, TX




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-02-06  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-06  0:00 Package name qualifier on function? Lane Wimberley
1998-02-06  0:00 ` Matthew Heaney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox