* Iterator trouble??
@ 2001-05-28 1:44 Michael Andersson
2001-05-28 6:44 ` Jeffrey Carter
0 siblings, 1 reply; 2+ messages in thread
From: Michael Andersson @ 2001-05-28 1:44 UTC (permalink / raw)
Hi!
Why do I get the following compiler error?
access discriminats allowed only for limited types
My code looks like this:
with Spline_Pkg; use Spline_Pkg;
package Spline_Pkg.SplineIterator_Pkg is
type SplineIterator(S : access Spline) is limited private;
function Next(Si : SplineIterator) return Point3;
private
type SplineIterator(S : access Spline) is
record
Index : Natural;
end record;
end Spline_Pkg.SplineIterator_Pkg;
with Point3_Pkg; use Point3_Pkg;
package Spline_Pkg is
type Spline is limited private;
type Point3Vector is array(NATURAL range <>) of Point3;
type IntVector is array(NATURAL range <> ) of Integer;
procedure Create(S : out Spline; Points : in Point3Vector; Steps : in
IntVector);
private
type Spline is array(0 .. INTEGER'Last) of Point3;
end Spline_Pkg;
Thanks!
/Michael
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Iterator trouble??
2001-05-28 1:44 Iterator trouble?? Michael Andersson
@ 2001-05-28 6:44 ` Jeffrey Carter
0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey Carter @ 2001-05-28 6:44 UTC (permalink / raw)
Michael Andersson wrote:
>
> Why do I get the following compiler error?
> access discriminats allowed only for limited types
>
> with Spline_Pkg; use Spline_Pkg;
>
> package Spline_Pkg.SplineIterator_Pkg is
> type SplineIterator(S : access Spline) is limited private;
> function Next(Si : SplineIterator) return Point3;
> private
> type SplineIterator(S : access Spline) is
> record
> Index : Natural;
> end record;
> end Spline_Pkg.SplineIterator_Pkg;
>
This is because the full declaration of type Splineiterator is not
limited. You could make it limited by replacing "is record" with "is
limited record".
Note that "with Spline_Pkg;" is unnecessary; child packages
automatically have visibility to their parents.
--
Jeff Carter
"Your mother was a hamster and your father smelt of elderberries."
Monty Python & the Holy Grail
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-05-28 6:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-28 1:44 Iterator trouble?? Michael Andersson
2001-05-28 6:44 ` Jeffrey Carter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox