comp.lang.ada
 help / color / mirror / Atom feed
* Linked List within a record?
@ 1996-05-05  0:00 Alvin A Begaye
  1996-05-07  0:00 ` James A. Krzyzanowski
  1996-05-09  0:00 ` Jerome Desquilbet
  0 siblings, 2 replies; 3+ messages in thread
From: Alvin A Begaye @ 1996-05-05  0:00 UTC (permalink / raw)





Why won't this work

package MyList is new gen_linked_list( Integer, "=" );

type arggh is record
  ID          : Integer;
  IntList     : MyList.List;
end record;


when i compile i get. completion of nonlimited type cannot be limited.

is there a way to do this?


-- 
Alvin Al Begaye -*- (520)523-7875 -*- aab@pine.cse.nau.edu




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

* Re: Linked List within a record?
  1996-05-05  0:00 Linked List within a record? Alvin A Begaye
@ 1996-05-07  0:00 ` James A. Krzyzanowski
  1996-05-09  0:00 ` Jerome Desquilbet
  1 sibling, 0 replies; 3+ messages in thread
From: James A. Krzyzanowski @ 1996-05-07  0:00 UTC (permalink / raw)



Alvin A Begaye (aab@pine.cse.nau.edu) wrote:

: Why won't this work

: package MyList is new gen_linked_list( Integer, "=" );

: type arggh is record
:   ID          : Integer;
:   IntList     : MyList.List;
: end record;


: when i compile i get. completion of nonlimited type cannot be limited.

: is there a way to do this?

I'm assuming type List must be limited private which means that any type
that uses type List as a component must also be limited private.

type arggh is limited private;

private

  type arggh is ...

end;

--
Not necessarily the opinion of the company...
--
---------------------------------------------------------------------------
         James A. Krzyzanowski - Senior Software Engineer - AFATDS
Magnavox Electronic Systems Company * Fort Wayne, IN 46808 * (219) 429-6446
Internet: jakrzy@most.fw.hac.com * AOL: JimShiz@AOL.com * MOST: jakrzy@most
     "I'd rather be right than politically correct !!!" - Rush is Right
---------------------------------------------------------------------------




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

* Re: Linked List within a record?
  1996-05-05  0:00 Linked List within a record? Alvin A Begaye
  1996-05-07  0:00 ` James A. Krzyzanowski
@ 1996-05-09  0:00 ` Jerome Desquilbet
  1 sibling, 0 replies; 3+ messages in thread
From: Jerome Desquilbet @ 1996-05-09  0:00 UTC (permalink / raw)
  To: Alvin A Begaye


Alvin A Begaye wrote:
> 
> Why won't this work
> 
> package MyList is new gen_linked_list( Integer, "=" );
> 
> type arggh is record
>   ID          : Integer;
>   IntList     : MyList.List;
> end record;
> 
> when i compile i get. completion of nonlimited type cannot be limited.
> 
> is there a way to do this?
> 
> --
> Alvin Al Begaye -*- (520)523-7875 -*- aab@pine.cse.nau.edu

I understand that your Gen_Linked_List generic package declares the
generic type Gen_Linked_List.List formal parameter as being limited
private. In that case, you can't use it as a record component type
(assignment issues). The only workaround is to use an access to this
type. Like this:

    type List_Access_Type is access MyList.List;
    type Hggra is
        record
            Id              : Integer;
            Int_List_Access : List_Access_Type;
        end record;

Of course, you'll have a manage your self allocations and deallocations
of objects of type List_Access_Type.

  Jerome.




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

end of thread, other threads:[~1996-05-09  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-05  0:00 Linked List within a record? Alvin A Begaye
1996-05-07  0:00 ` James A. Krzyzanowski
1996-05-09  0:00 ` Jerome Desquilbet

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