comp.lang.ada
 help / color / mirror / Atom feed
From: Lane Wimberley <lane@mcc.com>
Subject: Package name qualifier on function?
Date: 1998/02/06
Date: 1998-02-06T00:00:00+00:00	[thread overview]
Message-ID: <34DB9059.7E4E@mcc.com> (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




             reply	other threads:[~1998-02-06  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-06  0:00 Lane Wimberley [this message]
1998-02-06  0:00 ` Package name qualifier on function? Matthew Heaney
replies disabled

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