* on the use of "limited with"
@ 2005-10-08 13:45 evangeli
2005-10-09 7:42 ` Martin Dowie
0 siblings, 1 reply; 5+ messages in thread
From: evangeli @ 2005-10-08 13:45 UTC (permalink / raw)
hello,
i recently downloaded gnat gpl and tested the new Ada 05 feature
"limited with"
here are two packages which defines two types:
limited with q;
package p is
type tp_record is private;
type tp is access all tp_record;
function get_q(my_tp : in tp) return q.tq;
private
type tp_record is record ... end record;
end p;
--=====================================--
limited with p;
package q is
type tq_record is private;
type tq is access all tq_record;
function get_p(my_tq : in tq) return p.tp;
private
type tq_record is record ... end record;
end q;
i naturally get the following errors:
p.ads:5:42: invalid use of incomplete type
q.ads:5:42: invalid use of incomplete type
my question is the following: is there a way to declare p and q in two
separate packages?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: on the use of "limited with"
2005-10-08 13:45 on the use of "limited with" evangeli
@ 2005-10-09 7:42 ` Martin Dowie
2005-10-09 11:19 ` evangeli
0 siblings, 1 reply; 5+ messages in thread
From: Martin Dowie @ 2005-10-09 7:42 UTC (permalink / raw)
evangeli@cnam.fr wrote:
> hello,
> i recently downloaded gnat gpl and tested the new Ada 05 feature
> "limited with"
> here are two packages which defines two types:
>
> limited with q;
> package p is
> type tp_record is private;
> type tp is access all tp_record;
> function get_q(my_tp : in tp) return q.tq;
Try
... return access q.tq_record;
> private
> type tp_record is record ... end record;
> end p;
> --=====================================--
> limited with p;
> package q is
> type tq_record is private;
> type tq is access all tq_record;
> function get_p(my_tq : in tq) return p.tp;
Try
... return access p.tp_record;
Cheers
-- Martin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: on the use of "limited with"
2005-10-09 7:42 ` Martin Dowie
@ 2005-10-09 11:19 ` evangeli
2005-10-09 13:12 ` Martin Dowie
2005-10-11 0:12 ` Randy Brukardt
0 siblings, 2 replies; 5+ messages in thread
From: evangeli @ 2005-10-09 11:19 UTC (permalink / raw)
thanks for the help
does not seem to work neither :
function get_q(my_tp : in tp) return access q.tq;
p.ads:5:41: anonymous access type definition not allowed here
do i have to redefine an acces type on q.tq ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: on the use of "limited with"
2005-10-09 11:19 ` evangeli
@ 2005-10-09 13:12 ` Martin Dowie
2005-10-11 0:12 ` Randy Brukardt
1 sibling, 0 replies; 5+ messages in thread
From: Martin Dowie @ 2005-10-09 13:12 UTC (permalink / raw)
evangeli@cnam.fr wrote:
> thanks for the help
> does not seem to work neither :
>
> function get_q(my_tp : in tp) return access q.tq;
> p.ads:5:41: anonymous access type definition not allowed here
>
> do i have to redefine an acces type on q.tq ?
Hmmm, from memory, I think after reading John Barnes' paper on this you
may have to define the access type to the "limited with"-ed type locally
to where you want to use it.
It may be that all the Ada05 access type/limited with changes are not
yet implemented either.
Cheers
-- Martin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: on the use of "limited with"
2005-10-09 11:19 ` evangeli
2005-10-09 13:12 ` Martin Dowie
@ 2005-10-11 0:12 ` Randy Brukardt
1 sibling, 0 replies; 5+ messages in thread
From: Randy Brukardt @ 2005-10-11 0:12 UTC (permalink / raw)
<evangeli@cnam.fr> wrote in message
news:1128856766.691404.176910@z14g2000cwz.googlegroups.com...
> thanks for the help
> does not seem to work neither :
>
> function get_q(my_tp : in tp) return access q.tq;
> p.ads:5:41: anonymous access type definition not allowed here
Apparently, your version of GNAT doesn't implement this feature yet.
> do i have to redefine an acces type on q.tq ?
Yes, since GNAT apparently doesn't implement anonymous access results. You
are only allowed to use the type directly in subprogram specs. if (1) it's a
tagged type; and (2) it's a parameter (not the return type).
Randy.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-10-11 0:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-08 13:45 on the use of "limited with" evangeli
2005-10-09 7:42 ` Martin Dowie
2005-10-09 11:19 ` evangeli
2005-10-09 13:12 ` Martin Dowie
2005-10-11 0:12 ` Randy Brukardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox